I'm trying to develop an application using AIR for internal use at our company.

Our company uses very advanced actionscript (3.0) on the web, we load for instance several hundred or maybe more swfs sometimes into a parent swf, some that are animated.

Recently we decided that we need control over these loaded animated swfs - they need to adhere to an interface so we can stop the animations from the loading application when needed. The animations can be both timeline based and script based. As long as they adhere to the interface (basically play() stop() reset() and the "running" getter should return true if playing or false if stopped) we should be just fine.

The problem is that we need people who don't really know any scripting (designers) to be able to publish these
files properly. And I guess a template goes a long way but still...

So I thought: Hey there's AIR which have local filesystem access among other things. I could build an AIR App which loads a swf or even a whole dir of swfs and then casts the loaded swfs to IAnimatedItem and throws an error if it cant. It could also include play stop reset buttons to test every loaded swf manually to be sure it works. Nice indeed and simple
enough for most people to use...

The problem is though that I can't cast loaded swfs in AIR it seems, though I can from a simple swf loading one of these items (but then I lose filesystem dialogs etc which is why I thought of AIR in the first place).

In AIR
var aim:IAnimatedItem = loader.content as IAnimatedItem; (or loader.contentLoaderInfo.content as IAnimatedItem doesn't matter).

aim becomes null.

In simple Flash swf:

aim becomes IAnimatedItem.


if I do this in AIR:

var aim:IAnimatedItem = loader.content as IAnimatedItem;

if(aim is IAnimatedItem){
        trace('is IAnimatedItem');
} else {
        trace('is NOT IAnimatedItem');
}

this traces 'is NOT IAnimatedItem';

**

in simple Flash swf the same traces:

'is IAnimatedItem';

**

Also, doing a describeType in AIR OR Flash swf actually says it DOES implement IAnimatedItem. But, as I said, only in normal flash swfs is it castable to an IAnimatedItem. Why? Does this have something to do with the AIR security model and does anyone
know how I can achieve what I want in AIR?


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

Reply via email to