I'm building a game program and I've got a script that loads an external swf, and then duplicates the clip for the user to play. It worked until a few days ago when I reinstalled my OS (Mac OS 10.4.11) to fix an unrelated problem. The strange thing is that I had reinstalled the browser plugin to fix a related problem. Now the code works in the browser, but crashes the IDE and the Flash Player every time. I called Adobe Support but they were no help since it's "project related." I've reinstalled CS3 and Flash itself, but nothing helps.
Here's the code that crashes:
// INITIALIZE LOADER AND ADD TO STAGE
var myLoader:Loader = new Loader;
addChild (myLoader);
myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, isLoaded);
// DUPLICATE CLIP WHEN LOADED
function isLoaded (event:Event):void {
event.target.content.width = 100;
event.target.content.height= 200;
// THIS IS THE LINE THAT CRASHES
var copyClass:Class = Object(event.target.content).constructor;
var newThing:DisplayObject = new (copyClass);
addChild (newThing);
newThing.x +=50;
}
myLoader.load (new URLRequest('coloring/coloring1.swf'));
- // INITIALIZE LOADER AND ADD TO STAGE
- var myLoader:Loader = new Loader;
- addChild (myLoader);
- myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, isLoaded);
- // DUPLICATE CLIP WHEN LOADED
- function isLoaded (event:Event):void {
- event.target.content.width = 100;
- event.target.content.height= 200;
- // THIS IS THE LINE THAT CRASHES
- var copyClass:Class = Object(event.target.content).constructor;
- var newThing:DisplayObject = new (copyClass);
- addChild (newThing);
- newThing.x +=50;
- }
- myLoader.load (new URLRequest('coloring/coloring1.swf'));