How to control a dynamically loaded SWF
Solution 1
You need to add an event listener o the loader first so that you know when the load is complete. So from your code snippet i would suggest something like
var request:URLRequest = new URLRequest(file);
loader.addEventListener(Event.COMPLETE, function(event : Event) : void
{
var swfTimeline:MovieClip = loader.content as MovieClip;
swfTimeline.nextFrame();
});
loader.load(request);
Lots of different ways to organise this code but that should do the trick
Solution 2
Use the content property of the Loader object in which you are loading the SWF into. For example...
var swfTimeline:MovieClip = loader.content as MovieClip;
swfTimeline.nextFrame();
Solution 3
If you want to load the symbols from Flash to Flex then this should help.
loader.contentLoaderInfo.applicationDomain.getDefinition("here linkage name") as Class
This code enables a Movieclip to be placed on stage, with it's timeline-based actionscript (stop commands at the end of the animation, etc.) intact. One way to use this is the following:
var c:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("BA_doors") as Class
_animation = new c() as MovieClip
addChild(_doors)
Solution 4
Shouldfnt it be..
loader.currentTarget.content as MovieClip;
Solution 5
If you get a null trying to get to the content, you might have to wait for a loading complete event:
swfLoader.addEventListener(Event.COMPLETE, onSwfLoaded);
Once the swf has completely loaded, then you won't get a null any more.
One thing to be careful of is that even before you get the COMPLETE event, the main timeline on the swf will start running. You'll need to have a stop() on the first frame of the flash movie to do what you're trying to do... and even then it can be problematic. Sometimes the main timeline has a mind of its own.
In my project, we recently decided to totally clear the main timeline, and load movies out of the symbol library... Loading movieclips as symbols gives you complete control, but you would have to use transforms to get them placed correctly (since you don't have a main stage anymore.)
As long as you are using AS3 flash9 movie clips, you'll have complete control from Flex.
Enjoy!
Simon Breton
Updated on July 30, 2022Comments
-
Simon Breton over 1 year
I'm not sure my title is clear. Sorry about that. I have the following table :
ID ref. dummy_metrics dummy_dimensions 6091039909 A 123 foo 5914111836 B 456 bar 6538463041 C 789 foobar 6018474808 D 1010 bar 6091039909 foo 6091039909 foo 6538463041 foobar 6538463041 foobar 6538463041 foobar
As you can see some part of my table are empty. I would like to make sur that the
ref.
column is always filled with something. And I want this value to be based on theID<>ref.
key-pair combination.So here is my expected output :
ID ref. dummy_metrics dummy_dimensions 6091039909 A 123 foo 5914111836 B 456 bar 6538463041 C 789 foobar 6018474808 D 1010 bar 6091039909 A foo 6091039909 A foo 6538463041 C foobar 6538463041 C foobar 6538463041 C foobar
I don't want to have to build a pre-defined look-up table like I could do using the
CASE
formula. I want something dynamic for everyID<>ref.
key-pair combination I can found in my table. -
Simon Breton almost 6 yearsCan you explain a bit more ? I'm lost because of the sub-query.