Skip to main content
Participant
October 8, 2010
Question

Loading an asp document

  • October 8, 2010
  • 3 replies
  • 491 views

Hi, im stil a littlebit new to as3, and i was wondering if somewhone could help me with this problem:

when im trying to load an asp document the loader doesnt remove itself and it stops at 100% load

if i try a jpg file it works perfectly, but thats not what i want xD

---------------------------------------------------------------------------------------------------------------------------------------------------

var myRequest:URLRequest = new URLRequest("/aspindex.asp");

var myLoader:Loader = new Loader();

myLoader.load(myRequest);

myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);

myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);

var myPreloader:Preloader = new Preloader();

function showPreloader(event:Event):void {

addChild(myPreloader);

myPreloader.x = stage.stageWidth/2;

myPreloader.y = stage.stageHeight/2;

}

function showProgress(event:ProgressEvent):void {

var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;

myPreloader.loading_txt.text = "Loading - " + Math.round(percentLoaded * 100) + "%";

myPreloader.bar_mc.width = 1015 * percentLoaded;

}

function showContent(event:Event):void {

removeChild(myPreloader);

addChild(myLoader);

}

---------------------------------------------------------------------------------------------------------------------------------------------------

This topic has been closed for replies.

3 replies

MordretAuthor
Participant
October 8, 2010

what i want to do is basicly making a loading bar for my main page of the website.

im just experimenting with as3, making fun stuff ect.

,but ur saying should be something like this (stil not working xD)?

----------

var myRequest:URLRequest = new URLRequest("/aspindex.asp");

var myLoader:URLLoader = new URLLoader();

myLoader.load(myRequest);

var myPreloader:Preloader = new Preloader();

function showPreloader(event:Event):void {

addChild(myPreloader);

myPreloader.x = stage.stageWidth/2;

myPreloader.y = stage.stageHeight/2;

}

function showProgress(event:ProgressEvent):void {

var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;

myPreloader.loading_txt.text = "Loading - " + Math.round(percentLoaded * 100) + "%";

myPreloader.bar_mc.width = 1015 * percentLoaded;

}

function showContent(event:Event):void {

removeChild(myPreloader);

addChild(myLoader);

}

myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);

myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);

------

Ned Murphy
Legend
October 8, 2010

There's nothing wrong with experimenting.  Based on what I can see in the help documentation, the URLLoader class does not include a contentLoaderInfo property like the Loader class, so you should spend a little time looking into how to use that class as part of your experimentation.

Inspiring
October 8, 2010

First of all, listeners should be added BEFORE load() method is called. In local environment loading happens instantaneous and COMPLETE event is never fired.

Ned Murphy
Legend
October 8, 2010

What are you attempting to do with this asp file?  The Loader class is normally used for loading swf and image files.  Other file formats are usually loaded using the URLLoader class.  But the wondering as to what your intentions are remains because there isn't much Flash can do with an asp file (that I know of).