Re: [Flashcoders] Casting stage MCs as MovieClip yields null?!

2005-10-24 Thread James O'Reilly [JOR]

Hi Scott,

I don't know what your evalAppendedPath contained so I wrote my own to 
test your code.  Everything worked as expected for me so maybe you have 
a typo in your movie clip names or path.  I've uploaded an FLA if you 
want to take a look at my version: 
http://www.synergymedia.net/downloads/evalTest.zip


My code:

function evalAppendedPath (obj:Object, str:String):Object {
// Over simplified because I'm unsure what code
// you actually have in here.  This function could
// use error handling.
return eval( obj + . + str );
}

var result:Object = evalAppendedPath( my_mc, some.nested.clip );
trace( result );  // _level0.my_mc.some.nested.clip
trace( typeof( result )); // movieclip
var mc:MovieClip = MovieClip( result );
trace( mc ); // _level0.my_mc.some.nested.clip


Let me know if you find your problem,
JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net





Scott Whittaker wrote:

Hi there,

I have discovered what appears to be a bug in Flash (player 7): I have
a class method which takes an object and a path string in dot-notation
format, and evaluates the result of the combined path. e.g.

evalAppendedPath( my_mc, some.nested.clip );

would return the object result of: my_mc.some.nested.clip;

This is a general purpose method which can take any object as an
input, and the evaluated result could also be of any type, so the
method return type is always going to be Object.

This method works just fine, and is not the source of the problem.

The problem comes when I know what the expected return type is and I
need to cast it so that I can use it with strong typing. In every
case, casting the returned result works just fine, with the exception
of movieclips placed on the stage at authortime. For example:

var result:Object = evalAppendedPath( my_mc, some.nested.clip );
trace( result );  // _level0.my_mc.some.nested.clip
trace( typeof( result )); // movieclip
var mc:MovieClip = MovieClip( result );
trace( mc ); // null

But if I load an external swf asset, evaluate its path, and cast it,
the cast works and doesn't yield null.

Short of changing all my internal class references to type Object
instead of MovieClip (which could cause all sorts of problems trying
to mesh with other code) or loading all my assets externally (which
will cause load time issues) is there anything else I can do?

Thanks!

--

Scott Whittaker
Trilobyte Interactive
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Problem with .as files

2005-10-24 Thread James O'Reilly [JOR]

Michael Klishin wrote:

I. Franklin wrote:


Hi list,

I have encountered a bizarre problem with the .as files in one of my
projects.
The problem is that when I make any updations to the class file and
compile, it is not getting reflected in the project and moreover even
when I comment all the scripts in that class file, it compiles perfectly
and publishes and all the commented script works!!!. Any idea why this 
could happen?



Use this extension to clear ASO cache:

http://www.macromedia.com/cfusion/exchange/index.cfm?extid=1016963view=sn111 






Sweet, there's an extension!  I was thinking about writing a JSFL 
command to delete those aso files but this saves me the trouble.  Boy is 
it a pain to keep that folder open and delete the files manually before 
each publish.  Can't believe Macromedia hadn't thought of this??


JOR


___
===  James O'Reilly
===
===  SynergyMedia, Inc.
===  www.synergymedia.net

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders