Hmmm.

 

I don't have an easy answer for you.  I know there were some issues
during CS3 development around classes not getting included unless you
did some specific settings, but I thought we had resolved them.

 

One thing to make sure you're _not_ doing is sharing your source files
between Flex and Flash.  You can share interface source files, and you
can share non-display object source files, but don't share source files
for subclasses of MovieClip, Sprite, etc.

 

Here's why:

 

-          Developer opens CS3

-          Developer creates movieclip called 'Colorable'

-          Developer associates 'Colorable' with symbol X their library

-          Developer publishes as SWC.

-          CS3 emits the SWC, with the code that associates Colorable
with symbol X

-          Developer uses the SWC in their flex application

-          Flex compiles.  

-          Flex sees the Colorable source file.  Flex doesn't see any
[Embed] metadata on top of the Colorable class declaration. So Flex
creates an implicit blank symbol and  associates it with Colorable
(because the player requires an association for display object classes).
Oops! Flex just blew away your class/symbol association! Now when your
symbol shows up on the timeline at runtime, flash creates a dumb
movieclip instance for it, because it can't find any other associated
class.

 

If you share classes from CS3 to flex using SWCs, rather than source
files, you won't run into this problem.  It's entirely possible you're
running into other problems though.

 

 

Ely.

 

 

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of thegiffman
Sent: Monday, September 24, 2007 2:06 PM
To: [email protected]
Subject: [flexcoders] Re: Flex ignoring Actionscript Timeline Actions

 

Hi Ely,

Thanks for the tip. Mind if I ask one more question here?

I did as you demonstrated (using a SWC), and timeline code now works.
I am also able to access methods of classes defined in the linkage
base class of the symbol, which is also nice. However - I am not able
to execute methods on base classes of symbols CONTAINED therein. Let
me show you some example code.

My Person contains MovieClips, some of which contain or are themselves
an extension of "ColorableMovie". Basically I just want to specify a
particular instance as being the colorable part of the movie, leaving
other components alone. For instance, for the hair, I might have
transparent highlights and shadows, and I only want to color the
"colorable" part. 

So, the person contains various things that can be colored. 

Now, when I import the person into flex, I can see it as a subclass of
Person. However, when I call the "shirt" setter, though it executes
the code therein, the "color" setters are never called (though they
are if you load the swf dynamically at runtime).

Any advice on this one? Or is the response just "don't DO that!"

;-)

package com
{
import flash.display.MovieClip;
import flash.geom.ColorTransform;

public class ColorableMovie extends MovieClip
{
public function set color(color:uint):void{
var colorTransform:ColorTransform = new ColorTransform();
colorTransform.color = color;
this["_colorItem"].transform.colorTransform = colorTransform;
}
}
}

package com
{
import flash.display.MovieClip;

public class Person extends MovieClip
{
public function set shirt(color:uint){
this["_leftArm"]._shirt.color = color;
this["_rightArm"]._shirt.color = color;
this["_body"]._shirt.color = color;
}
}
}

 

<<image001.jpg>>

<<image002.jpg>>

Reply via email to