2 Replies Latest reply on May 4, 2008 11:33 AM by slaingod

    How to properly associate an exported Flash component with a custom class

    Backov
      I'm not a Flash expert at all - I got into Actionscript with Flex 3 and am now trying to get Flash to cooperate in exporting some stuff for use in Flex.

      I've gotten some basic stuff to work (exporting buttons wrapped in UIMovieClips) but not much else. What I want is to export one of these buttons with some custom code - in this case, I want it to behave like a radio button. The code is no problem at all, the problem is getting it to use the code.

      I either get a problem where it can't find the class file.. Or it does and then says that I can't use UIMovieClip as the base class and I should fill in flash.display.MovieClip... I've tried it both ways and it never works.

      What's the simple way to export a flash UIMovieClip with a custom class? Can someone give me the bare bones way to get it to work?
        • 1. Re: How to properly associate an exported Flash component with a custom class
          jeremy.moo
          When I've embedded assets in the past, I haven't used assets outside of the images in my swf, which is done like this:

          <mx:Script>
          <![CDATA[
          [Embed(source="filename.swf" symbol="symbolName")]
          [Bindable]
          public var rndmName:Class;
          ]]>
          </mx:Script>

          <mx:Image id="rndmname" source="{rndmName}"/>


          and, actually, that whole symbol thing doesn't seem totally right. The symbols themselves are classes when your flash file is saved as a swf w/ as3 (I think -- though i'm not a flash person), so it would have to be something similar to that.

          google "embed swf classes" and let us know what you learn.
          • 2. How to properly associate an exported Flash component with a custom class
            slaingod Level 1
            In general you need to create an AS3 class to go along with your swf, and set it to that file in the Publisher settings.

            Something like:
            package {
            import flash.display.MovieClip;
            import flash.events.Event;

            [Event(name="PLAYBACK_COMPLETE", type="flash.events.Event")]

            public dynamic class intro extends MovieClip {

            function intro():void {

            }
            }
            }

            (This example also allows you to throw an event that can be caught by your flex app to tell when an 'intro movie' created in flash has finished playing.)

            I'm not sure of the differences betweeen using UIMovieClip and MovieClip here.