brianr
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by brianr
-
-
Hi Carl, thanks for the quick response!
Your suggestion is essentially what I've done at this point (option 2). Now that I've removed the DisplayObjectContainer and turned mediaContainer back to a Sprite, it doesn't throw the error any more but still doesn't seem to be adding the loaded swf to the container as when I change the x, y, coords of the container, the swf doesn't move accordingly. Also I put a trace statement after the loader and it shows that mediaContainer has 0 children.
public var mediaContainer:Sprite = new Sprite(); ... addChild(mediaContainer);
public function LoaderMax_subload_parent():void { var subloadSWFpath:String = menuXML.slide[slideIndex].mediaPath; var swfScale:Number = menuXML.slide[slideIndex].mediaPath.@scale; trace("swfScale = " + swfScale); _swfLoader = new SWFLoader(subloadSWFpath, { container:mediaContainer, scaleX:swfScale, scaleY:swfScale, onComplete:_completeHandler}); _loadHandler(); trace("mediaContainer children = " + mediaContainer.numChildren);
private function _completeHandler(event:LoaderEvent):void { //add the SWFLoader's content to the stage addChild(event.target.content); setChildIndex(event.target.content,0); }
-
I'm using SWFLoader to load a swf and want to load it into a container. According to the API Documentation, i can use:
container : DisplayObjectContainer - A DisplayObjectContainer into which the content Sprite should be added immediately.When I try and do this I get Error #2012: DisplayObjectContainer$ class cannot be instantiated. So I use the import statement as follows:
import flash.display.DisplayObjectContainer;
but still same thing. When I googled the error it came up with info about it being an abstract class and the remedy would be to use
extends DisplayObjectContainer
but I need mine to be
extends MovieClip
. I tried extending sprite but that threw a frame error, so it needs to be movieclip. What else can I do?
Using DisplayObjectContainer yields error 2012
in Loading (Flash)
Posted
Thanks!!