Hi;
I had another idea on how to tackle this problem of wanting to load two
different swfs at the same time. (Please read thread if you don't understand
what I mean.) Then I want to call/load an URL. I get no errors, however, it
doesn't surf to the desired page, either. (Yes, I've loaded it on the
server.) Here's the complete code:

package
{
import flash.display.Bitmap;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.net.URLRequest;
 public class Preloader extends MovieClip
{
var loader:Loader = new Loader();
var loader2:Loader = new Loader();
var loader3:Loader = new Loader();
private var myTextField:TextField = new TextField();
var imgFlag1:Boolean = new Boolean(false);
var imgFlag2:Boolean = new Boolean(false);

public function Preloader()
{
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
 private function init(e:Event)
{
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
// loader.load(new URLRequest("images/logo.png"));
loader2.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded2);
// loader.load(new URLRequest("images/map.png"));
loader2.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
removeEventListener(Event.ADDED_TO_STAGE, init);
addChild(myTextField);
myTextField.width = 250;
myTextField.x = stage.stageWidth/2 - 50;
myTextField.y = stage.stageHeight/2;
myTextField.selectable = false;
myTextField.border = false;
myTextField.borderColor = 0xAA0000;
myTextField.autoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
myFormat.color = 0xAA0000;
myFormat.size = 24;
myFormat.italic = true;
//myTextField.setTextFormat(myFormat);
myTextField.defaultTextFormat = myFormat;
}

private function imageLoaded(event:Event):void
{
var image:Bitmap = new Bitmap(event.target.content.bitmapData);
addChild(image);
imgFlag1 = true;
if (imgFlag2 == true)
{
completePreloader();
}
}
 private function imageLoaded2(event:Event):void
{
var image:Bitmap = new Bitmap(event.target.content.bitmapData);
addChild(image);
imgFlag2 = true;
if (imgFlag1 == true)
{
completePreloader();
}
}
 function completePreloader()
{
loader3.load(new URLRequest("index.py"));
addChild(loader3);
}
 function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded/e.bytesTotal;
myTextField.text = Math.ceil(perc*100).toString() + "%";
}
}
}

Please advise.
TIA,
V
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to