Download and display images.Works in FlashPro,but doesnt after Publish as SWF.
Hi,
I spent quite a while to code the preloader scene to download few images from photobucket, so that i can update photos, instead of compiling the FLA everytime.
The problem is, everything works accordingly in FlashPro by using "Test Movie", however after I publish it as SWF,the SWF will play in IE8/Chrome, but it won't connect to photobucket to download the images, thus, the preloader scene never get pass.
Any suggestions?
http://www.autohotkey.net/~evanlim86/EL2_29f.fla
http://www.autohotkey.net/~evanlim86/EL2_29f.swf
stop();
var imagesArray:Array = new Array(
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_1.jpg',
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_2.jpg',
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_3.jpg',
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_4.jpg',
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_5.jpg',
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_6.jpg',
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_7.jpg',
'http://img.photobucket.com/albums/v439/evanxxxm/elsesite_flash/th_8.jpg');
loadingLogo.alpha = 0.0;
var loadedArray:Array = new Array();
var counter:int = 0;
loadingLogo.addEventListener(Event.ENTER_FRAME, fl_FadeSymbolIn);
function loadImage():void
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
loader.load(new URLRequest(imagesArray[counter]));
}
function loaded(e:Event):void
{
loadedArray.push(e.target.content);
if (counter == imagesArray.length-1)
{
for (var i:uint = 0; i < loadedArray.length; i++)
{
loadedArray.width = 90;
loadedArray.height = 90;
loadedArray.x = 1;
loadedArray.y = 1;
if (i == 7)
{
CompleteDownloadImage();
}
}
}
else
{
counter++;
loadImage();
}
}
function CompleteDownloadImage():void
{
this.loadingClip.visible = false;
loadingLogo.removeEventListener(Event.ENTER_FRAME, fl_FadeSymbolIn);
loadingLogo.addEventListener(Event.ENTER_FRAME, fl_FadeSymbolOut_3);
}
function fl_FadeSymbolOut_3(event:Event)
{
if (loadingLogo.alpha <= 0)
{
loadingLogo.removeEventListener(Event.ENTER_FRAME, fl_FadeSymbolOut_3);
this.loadingLogo.visible = false;
DisplayDownloadImage();
}
else
{
loadingLogo.alpha -= 0.04;
}
}
function fl_FadeSymbolIn(event:Event)
{
if (loadingLogo.alpha >= 1)
{
this.loadinglogoELSE.visible = false;
loadImage();
loadingLogo.removeEventListener(Event.ENTER_FRAME, fl_FadeSymbolIn);
}
else
{
loadingLogo.alpha += 0.03;
}
}
function DisplayDownloadImage():void
{
gotoAndStop(2,"PreloaderScene");
}