Flash CS5.5 Library & Flash Builder 4.5 workflow

Because of intricate animations for an iOS project, I'm kinda forced to use Flash CS5.5 IDE, but I'm trying to use Flash Builder 4.5.1 to code library movieClips. For the most part this is working; I'm making movieClips in the library, giving them class names I then edit in FB 4.5. My rationale is for iOS it all has to be one big ass file anyway. I don't really want to make everything a swc and embed in Flash Builder, just want to make movieClips and edit their code in FB.

But, say I have made a ball in the Flash IDE. In the Library I give it a class name of 'Ball' that extends MovieClip. When I go back to Flash Builder in my main class I use

var _ball:Ball = new Ball(); addChild (_ball)

The code works and the ball is placed from library onto stage, however there is the "?" next to the Ball instantiation suggesting the type cannot be found or is not a compile time constant. I don't really want to make a custom class for Ball - although I'm pretty sure if I did and imported a custom Ball class it would find it and the '?' would go away, but is there not a way to force Flash Builder 'see' the Flash IDE library objects/classes?

Many Thanks!


In Flash Professional, the AS Linkage should match the class name. You can right-click from the library and "Edit Class", then select Flash Builder to edit the class.

Test the AS Linkage to assure your class package is correctly referenced from Flash Professional to your code.

Views constructed in Flash Professional will instantiate and add children. If you drag your "Ball" movie clip from the library to the artboard, at runtime the "Ball" class will be instantiated and added to stage.

If the symbol requires no programmatic implementation, then there's no need to create the class.

As per size, there's no magic to the symbol's class definition - Flash Pro automatically creates the class for you. You won't know it's name or how it's been defined when the compiler references the class.

This question could be refined to better understand your objective, or specific issue you are experiencing.

If your desire is to code in Flash Builder, than use Flash Pro to design and layout your views, and export SWC from Flash Pro. In Flash Builder, use the [Embed] meta tag to reference the symbols.

If your desire is to code in Flash Pro, you can still use Flash Builder when editing code.

The "?" does not mean there is an error. It's a warning. You might see it all over the place from the default package - things like int, string, Number, MovieClip may show a "?" on the left by the line numbers because the playerglobal.swc from Flash Pro needs corrected in your Flash Builder's .actionScriptProperties.

Flash Pro's compiler should resolve those references and build your SWF; however, editing in Flash Builder may be tedious without code completion, or simply seeing so many "?" by line numbers.

I'd suggest:

  • Create your FLA in Flash Pro.
  • Establish a base class, or give a AS Linkage class name to a symbol.
  • From the library, "Edit Class" in Flash Builder, and let Flash Builder stub the project in your workspace referencing Flash Pro's src.
  • If you see "?" from default package classes, update your .actionScriptProperties by replacing the playerglobal.swc:

    <libraryPathEntry kind="3" linkType="1" path="${FLASHPRO_APPCONFIG}/ActionScript 3.0/FP10.2/playerglobal.swc" useDefaultLinkType="false"/>

  • If your symbol has no AS Linkage, you cannot reference it using ActionScript, unless you can assure access via a base class such as calling objects as MovieClip. This would not be recommended.


    The workflow you're describing in your question has always bothered me. Setting a linkage file of an asset seems like to much of a coupling to me - at the end this is just a bunch of assets - why should I couple them with some fixed behavior? Assets for a button should also be sufficient and for a toggle button. Couple it with the Button-class and then you need to duplicate an asset and link it to the ToggleButton. Some may argue that there should only be one Button-class with toggable-property. Nevertheless, I think you all are getting the point. That's why I relly dig into Flex 4 and into the whole designer-developer contract and very decoupled way of using component and a skin.

    There is a way to use this approach in Flash without setting any linkages in the FLA. In fact I'm using the compiled SWF as an assets library of skins. I've developed a component model inspired from the early inception of Gumbo and the OpenFlux framework and applied similar principles in Flash. If you're interested in the details you can read the introduction article in my blog about the FLit framework. The whole code + examples are available at Google Code.

    链接地址: http://www.djcxy.com/p/48266.html

    上一篇: 舞台什么时候加载?

    下一篇: Flash CS5.5库和Flash Builder 4.5工作流程