R – Flash CS4: Unresponsive error when using “Loader.contentPath”

actionscript-2adobeflashflash-cs4

I want to display http://www.flash-mx.com/images/image1.jpg image as a thumbnail box in my flash SWF file. TO do so I have taken a Loader control in my flash movie and named it as my_thumb and then writing the code as:

 _parent.my_thumb.contentPath = "http://www.flash-mx.com/images/image1.jpg";

But I am getting following error after adding above line in my flash code.

---------------------------
Flash Player
---------------------------
A script in this movie is causing Flash Player to run slowly.  
If it continues to run, your computer may become unresponsive.  
Do you want to abort the script?
---------------------------
Yes   No   
---------------------------

And If I am removing the above line form my code then it works fine, no issues.

I am not able to figure out why this is occurring. I am a beginner in flash and do not have much idea about these kind of error.

Please check!

Thanks

Best Answer

var url:String = "http://www.helpexamples.com/flash/images/image2.jpg";
var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);
movieClip.loadMovie(url);

movieClip._x=200;
movieClip._y=200;

function onEnterFrame(){
    //trace(movieClip._width);
    //trace(movieClip._height);
    if (movieClip._width!=0){
        setDimension(movieClip,100,100);
        delete onEnterFrame;
    }
}

function setDimension(mc:MovieClip,w:Number,h:Number){
    mc._width=w;
    mc._height=h;
}
Related Topic