Skip to main content
Participant
April 12, 2014
Question

Change some code from as3 to as2

  • April 12, 2014
  • 1 reply
  • 347 views

Hi, I want to use as2 because it compatible with my website.

I want to change some code from as3 to as2

/////////////////////////////image1////////////////////////////////

if(MovieClip(this.parent).imagetxt.text == "a") {

    var imgurl:String = "C:/Users/Thái/Desktop/ls/cotton-1.jpg";

    var myrequest:URL = new URL(imgurl);

    myloader.scaleContent = true;

    myloader.load(myrequest);

}

/////////////////////////////image2////////////////////////////////

else if(MovieClip(this.parent).imagetxt.text == "b") {

    var imgurl2:String = "http://aloflash.com/images/upload/3.jpg";

    var myrequest2:URLRequest = new URLRequest(imgurl2);

    myloader.scaleContent = true;

    myloader.load(myrequest2);

}

thank you for your support.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 12, 2014

use:

var myloader:MovieClip=this.createEmptyMovieClip("loader_mc",this.getNextHighestDepth());

if (MovieClip(this._parent).imagetxt.text == "a") {

    var imgurl:String = "C:/Users/Thái/Desktop/ls/cotton-1.jpg";

    myloader.load(imgurl);

} else if (MovieClip(this._parent).imagetxt.text == "b") {

    var imgurl2:String = "http://aloflash.com/images/upload/3.jpg

    myloader.load(imgurl2);

}

Participant
April 12, 2014

thank you for your support

But it has one error in line

var myloader:MovieClip=this.createEmptyMovieClip("loader_mc",this.getNext HighestDepth());

This error is

Symbol=togglewindow, layer=as, frame=11, Line 13')' or ',' expected
kglad
Community Expert
Community Expert
April 12, 2014

change your publish settings to as2.