Question

I've been programming ActionScript 3 for some while and I've recently decided to ditch Flash Professional in favour of FlashDevelop. I'm glad of the choice, but I eventually found a small problem: Since I don't have access to Flash Professional's graphics library there's a lot of code that tries to reference non-existent clips. Let's work with this example where MC1 is an element of the FlashPro library:

public class GraphicElement
{
    public var clip:DisplayObject;

    function GraphicElement(theClip:DisplayObject)
    {
        this.clip = theClip;
    }
}

//And in another Class:

var myGraphic:GraphicElement = new GraphicElement(new MC1() as DisplayObject);

In FlashDevelop, "new MC1()" means nothing. How do I import graphics to use with the DisplayObject class?

Was it helpful?

Solution 2

Fixed. What I said was a very complicated phrasing for "How do I embed images to my project?" Found the answer here: http://www.streamhead.com/how-to-use-images-in-actionscript-3-with-flashdevelop-and-some-other-as3-tips/

OTHER TIPS

To use graphics from a FLA, first publish the FLA containing your graphics as an SWC. In CS5.5 you can set this in File -> Publish Settings..., then publish it. Now bring the generated SWC in your Flash Develop project folder, you can put it anywhere although the "lib" folder is typically where it would go. Finally, open your Flash Develop project, and in the project pane on the right, right click on your SWC and click Add To Library.

Now you should be able to access the stuff in your library as usual, just as if you were coding in the FLA itself. This includes not only MovieClips or Buttons, but also imported images or in-built Flash Components, as long as it's in the library. Of course, anything you want to access needs to be exported for ActionScript too.

Hope that helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top