View unanswered posts | View active topics



Reply to topic  [ 45 posts ]  Go to page 1, 2, 3  Next
FD3 Sample projects 
Author Message
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Using Flash CS3 components with FlashDevelop 3

This sample project shows how to use Flash CS3 to create a resource SWC including components and/or graphics to be used in a FlashDevelop project.

Requirements:
- FlashDevelop beta5+
- Flex 3 beta3 SDK
- Flash CS3

Usage
- download and unzip the sample project
- you will find a FLA file in the /library directory
- this FLA is configured to generate a SWC file (see publish settings)
- which is added to the FlashDevelop project (right-click > Add to Library)
- open /classes/Main.as to see how the SWC content is simply available for coding.

Possible issues
- if you have several FLA files you should publish the SWCs in a different location - if a SWC is present near a FLA it can corrupt the compilation,
- some CS3 components (like Button) require that you set their width/height explicitely or they will not appear.

VERY important notes
- if a symbol in the FLA has a class, this class must NOT be in the project classpath - this would break the association between the class and the graphical symbol,
- the SWF file in /library is not used in any way - only the SWC is useful but Flash can't be told to not publish the SWF,
- do not set the FLA's Document class.


Last edited by Philippe on Wed Jun 18, 2008 5:43 pm, edited 3 times in total.



Fri Jan 18, 2008 7:01 pm
Profile WWW
Member

Joined: Thu May 15, 2008 4:14 pm
Posts: 52
Post 
The project doesn't play when I press ctrl+F8. But it plays well when I press ctrl+Enter.
what's the best way to test a movie?


Fri May 16, 2008 2:00 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Post 
ares623 wrote:
The project doesn't play when I press ctrl+F8. But it plays well when I press ctrl+Enter.
what's the best way to test a movie?

Ctrl+F8 is only for building the current class - this is completely ignoring the project. It can be configured using a special @mxmlc tag in the code.
Ctrl+Enter is for building the project.


Fri May 16, 2008 7:37 am
Profile WWW
Member

Joined: Tue May 20, 2008 12:44 pm
Posts: 8
I unzipped the file, I noticed that there were 2 CS3Components.swf files. I double clicked on the CS3Components.swf that was in the CS3Components folder and all worked fine. But when I tried to play the CS3Components.swf that was in the "library" folder, it did not play.

So I replaced the first file that was in the CS3Components folder with this second CS3Components.swf, but again, I got a blank screen.

When I opened the Main.as file, tried to export and play it with Cntl + Enter, again, the screen was blank.

1) Do I need to do something special to make this play?

2) Also, is there a manual that explains how to use FlashDevelop?

_________________
Brad


Wed May 28, 2008 9:54 am
Profile
Member

Joined: Fri Mar 09, 2007 8:02 am
Posts: 278
Post 
simo90,give me your email. and i send the swc_fd3 project to you.


Wed May 28, 2008 10:00 am
Profile
Member

Joined: Tue May 20, 2008 12:44 pm
Posts: 8
I kept playing and realized that I had not linked the Document class for the downloaded CS3Components.fla file to the Main.as file. Once I did that, it all played fine.

_________________
Brad


Wed May 28, 2008 10:11 am
Profile
Member

Joined: Wed Feb 27, 2008 8:21 pm
Posts: 14
Post 
This sample is all great, except I am trying to figure how to work with the AS2 way where a movieclip in the library export linkage does have its own class.

In this CS3Components sample:
TestGraphic is exported "TestGraphic" and was instantiated in Main.as:
gfx = new TestGraphic();
gfx.y = 30;
addChild(gfx);

This is all good, but what if I do have a class/file TestGraphic.as, could be simple as:
package
{
import flash.display.MovieClip;
import flash.text.TextField;


public class TestGraphic extends MovieClip
{
public var myText:TextField;

public function TestGraphic()
{
myText = new TextField();
addChild(myText);
myText.text = "Love";
}
}
}

Adding this TestGraphic.as to the sample project, and run it again. It gfx is instantiated with the custom TestGraphic class but it ignores the little box TestGraphic movieclip to be exported in the library.


In another word, is there a way that movieclip to be exported in .swc can act on its own Class?


Thu Jun 05, 2008 10:48 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
simo90 wrote:
I kept playing and realized that I had not linked the Document class for the downloaded CS3Components.fla file to the Main.as file. Once I did that, it all played fine.

I fixed the sample so it is less confusing. The SWF in /library is not used in any way - only the SWC is useful but Flash can't be told to not publish the SWF.

The FLA is here to provide symbols that will be used in the project compiled by FlashDevelop using the Flex SDK. You must NOT link the Main class as the FLA's Document class.


Fri Jun 06, 2008 7:07 am
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Post 
kyle wrote:
In another word, is there a way that movieclip to be exported in .swc can act on its own Class?

If a symbol in the FLA has a class, this class must NOT be in the project classpath - this would break the association between the class and the graphical symbol.

AFAIK there is no way to associate a class and a symbol like in AS2. You must use "composition", that is attaching the symbol in a class extending Sprite.


Fri Jun 06, 2008 7:15 am
Profile WWW
Member

Joined: Fri Jun 27, 2008 7:08 am
Posts: 1
Post 
Hi, Philippe
My FlashDevelop's version is 3.0.0 beta6

I downloaded your source project, but when i build it, it could not work with some compile error like can not find the class Lable.

I right clicked the CS3Library.swc and added it into library.
I use the FlashDevelop's own 'FlashDevelop\FirstRun\Library\AS3\frameworks\FlashCS3' as one Global Classpath.

If i Build the project or test movie, it will jump internal error like function had no procedure etc..

Is that means i must use the Flash CS3 software's classpath?


Fri Jun 27, 2008 8:53 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Post 
huakaibird wrote:
Hi, Philippe
My FlashDevelop's version is 3.0.0 beta6

I downloaded your source project, but when i build it, it could not work with some compile error like can not find the class Lable.

I right clicked the CS3Library.swc and added it into library.
I use the FlashDevelop's own 'FlashDevelop\FirstRun\Library\AS3\frameworks\FlashCS3' as one Global Classpath.

If i Build the project or test movie, it will jump internal error like function had no procedure etc..

Is that means i must use the Flash CS3 software's classpath?

Oh never add anything from 'FlashDevelop\FirstRun\Library\AS3' in your global or project classpath. This is not valid code. It must be added to the project "Intrinsic paths" in the Project compiler options.


Fri Jun 27, 2008 9:43 am
Profile WWW
Member

Joined: Tue Jul 01, 2008 10:08 am
Posts: 9
Post 
Hi!

I've just downloaded the sample project and got it to work. What I don't get though is how to use classes for the library symbols. Can anyone please upload a sample project that uses individual classes for the library symbols or explain to me how to make this work.

I'm using FD 3.x btw.


Tue Jul 01, 2008 2:06 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Post 
simpel wrote:
Hi!

I've just downloaded the sample project and got it to work. What I don't get though is how to use classes for the library symbols. Can anyone please upload a sample project that uses individual classes for the library symbols or explain to me how to make this work.

I'm using FD 3.x btw.

The correct way of working with library symbols from a SWC is to create a class extending the library symbol (inheritance) or adding the symbol as a child (composition).

Ex if you have a symbol "TestGraphic" (like in the sample project):
Code:
package
{
  public class CustomTestGraphic extends TestGraphic
  {
    public function CustomTestGraphic() {}
  }
}

or:
Code:
package
{
  public class CustomTestGraphic extends Sprite
  {
    private var symbol:TestGraphic;

    public function CustomTestGraphic() {
      symbol = new TestGraphic();
      addChild(symbol);
    }
  }
}


Tue Jul 01, 2008 6:27 pm
Profile WWW
Member

Joined: Tue Jul 01, 2008 10:08 am
Posts: 9
Post 
Woohoo! Now it's working like a charm! thanks Philippe, you made my day!


Wed Jul 02, 2008 7:23 am
Profile
Member

Joined: Sat Nov 22, 2008 3:49 pm
Posts: 1
After trying all day this example is getting closer to what I need. Finally I'm able to create a custom class for the library symbol.
I've just started to get to know FlashDevelop in it's own way (been using it before as a superior editor to the Flash IDE's).
My question:
In Flash IDE I've created several animated figures and linked them to their classes (right now I use one called BlackKnight and another one called Soldier).
Both of them extend a class named Piece which extends MovieClip. This class contains pretty much all of the code. The subclasses only set their framenumber specific properties and they have a visual animations in their timelines.
Right now I'm trying to get BlackKnight into FD.
According to this example I should have something like (in my own names):
CustomBlackKnight extends LibrarySymbolBlackKnight
But I also need something like:
CustomBlackKnight extends Piece

So: Is it possible to make different library symbol classes extend a seperate class? Is so, how do I make this happen?

regards,
Jasper


Sat Nov 22, 2008 4:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 45 posts ]  Go to page 1, 2, 3  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.