I'm not sure if this helps but I recently loaded an SWF into a Flex app and had 
problems with accessing the root timeline of that SWF.
Other than what I read in the web (simply accessing the "content" property of 
the SWFLoader) I had to go deeper which resulted in the following construct:

(((swfAnimation.content as MovieClip).getChildAt(0) as Loader).content as 
MovieClip).someFunction()

"swfAnimation" is of type spark SWFLoader.
Maybe this helps.







Mit freundlichen Grüßen / Best Regards
i.A. Jan Weber
Software Development



Contact:


Location:


Head & Accounts Office:


tel


+49 941 8700 326


Bahnhofstr. 16


Bahnhofstr. 16


fax



93047 Regensburg


93047 Regensburg


mail


[email protected]<mailto:[email protected]>


Germany


Germany


[banner]
<http://www.dallmeier.com/index.php?id=1054>


Subscribe to our Newsletter<http://www.dallmeier.com/index.php?id=322&L=1>


www.dallmeier.com<http://www.dallmeier.com/en/home.html>


Social Media<http://www.dallmeier.com/index.php?id=292&L=1>



Dallmeier electronic GmbH & Co.KG

CEO:
Registry Court:
VAT ID:
Unlimited Partner:
Registry Court:


         Dieter Dallmeier
         Amtsgericht Regensburg HRA 6827
         DE813790649
         Dallmeier GmbH
         Amtsgericht Regensburg HRB 9085





-----Ursprüngliche Nachricht-----
Von: DarrenEvans <[email protected]>
Gesendet: Mittwoch, 11. September 2019 12:30
An: [email protected]
Betreff: Re: SWFLoader not pulling through all sub SWF styles

ACHTUNG: Diese Mail kommt von einem externen Absender. Bitte behandeln Sie alle 
Dateianh?nge und Links mit besonderer Vorsicht. Im Zweifel wenden Sie sich 
bitte an die IT.

We are using Flex SDK 4.6.0.23201 (with built in AIR SDK 3.1.0.4880) for both 
the Air application host and the SWF being loaded.

We gave up on the styling problem (loading the SWF in to the same application 
domain).

We swapped it to load in to it's own application domain, ala:
*var appDomain:ApplicationDomain = new ApplicationDomain();*
var loader:URLLoader = URLLoader(event.target);
var context:LoaderContext = new LoaderContext(false, *appDomain*);
context.allowLoadBytesCodeExecution = true;

swfLoader.loaderContext = context;
swfLoader.addEventListener(Event.COMPLETE, loadComplete);
swfLoader.load(loader.data);

Doing this reintroduced the problem (we'd already been down this road) of 
resizing. Once the app had loaded the SWF it was impossible to get it to resize 
the content.

We solved this by subclassing SWFLoader and adding a new method (which has 
access to the real content):
public function changeSize(height: Number, width: Number):void {
if (contentHolder is FlexLoader){
const sm:DisplayObject = FlexLoader(contentHolder).content as DisplayObject;
if (sm) {
sm["setActualSize"](width, height);
sm["application"]["setActualSize"](width, height);
}
}
}

We did stumble initially on this as we wanted to cast 
FlexLoader(contentHolder).content directly to a SystemManager. However, even 
though it looks like a SystemManager in the debugger the cast fails. Using 
reflection to call setActualSize on the content (and its application) works 
though.

We were baffled by this and could only assume it was something to do with how 
the SWF file is configured/merged/built.

Any ideas on why that cast would fail?



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Reply via email to