Script crashes IDE and Flash Player but works in browsers

  • activa
  • Born
  • Born
  • activa
  • Posts: 2

Post 3+ Months Ago

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:

Code: [ Select ]
// 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'));
  1. // INITIALIZE LOADER AND ADD TO STAGE
  2. var myLoader:Loader = new Loader;
  3. addChild (myLoader);
  4. myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, isLoaded);
  5. // DUPLICATE CLIP WHEN LOADED
  6. function isLoaded (event:Event):void {
  7.     event.target.content.width = 100;
  8.     event.target.content.height= 200;
  9.     // THIS IS THE LINE THAT CRASHES
  10.     var copyClass:Class = Object(event.target.content).constructor;
  11.     var newThing:DisplayObject = new (copyClass);
  12.     addChild (newThing);
  13.     newThing.x +=50;
  14. }
  15. myLoader.load (new URLRequest('coloring/coloring1.swf'));
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 8 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.