Hi,
Abdul,
Here
is my example code,
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.ProgressBar;
import mx.controls.Image;
import flash.events.*;
import flash.display.*
private function loadImage(url:String) : void {
var myloader:Loader = new Loader();
addEventListeners(myloader);
var myprogress:ProgressBar = new ProgressBar();
myprogress.source = myloader;
myvbox.addChild(myprogress);
var myurlrequest:URLRequest = new URLRequest(url);
myloader.load(myurlrequest);
}
private function addEventListeners(ldr:Loader) : void {
ldr.addEventListener(Event.COMPLETE, handleComplete);
}
private function handleComplete(event:Event) : void {
var myimage:Image = new Image();
var ldr2:flash.display.Loader = flash.display.Loader(event.target);
myimage.load(ldr2.content);
myvbox.addChild(myimage);
}
]]>
</mx:Script>
<mx:VBox id="myvbox">
<mx:Button label="load" click="loadImage(>>THE URL OF IMAGE<<)"/>
</mx:VBox>
</mx:Application>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.ProgressBar;
import mx.controls.Image;
import flash.events.*;
import flash.display.*
private function loadImage(url:String) : void {
var myloader:Loader = new Loader();
addEventListeners(myloader);
var myprogress:ProgressBar = new ProgressBar();
myprogress.source = myloader;
myvbox.addChild(myprogress);
var myurlrequest:URLRequest = new URLRequest(url);
myloader.load(myurlrequest);
}
private function addEventListeners(ldr:Loader) : void {
ldr.addEventListener(Event.COMPLETE, handleComplete);
}
private function handleComplete(event:Event) : void {
var myimage:Image = new Image();
var ldr2:flash.display.Loader = flash.display.Loader(event.target);
myimage.load(ldr2.content);
myvbox.addChild(myimage);
}
]]>
</mx:Script>
<mx:VBox id="myvbox">
<mx:Button label="load" click="loadImage(>>THE URL OF IMAGE<<)"/>
</mx:VBox>
</mx:Application>
Thanx
for the quick responses!
Richard
-----Original Message-----Hi, Richard
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]On Behalf Of Abdul Qabiz
Sent: Monday, March 06, 2006 5:02 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders]Question about the Loader class
I would like to look at your code, can you post a complete but simple version of your code...
I am sure, Flash Player would not load data if it is already cached. There is something going wrong somewhere...
-abdul
On 3/6/06, Richard Schutten <[EMAIL PROTECTED]> wrote:Does someone has a answer for my question,
I've a question about the Loader class in Flex 2. I've created a simple
project that adds an Image object to a VBox when a button has been clicked.
I load the Image with the content of the Loader. I also connected a
ProgressBar which shows the progress of bytes loaded. The first time i run
the project it works fine. The progressbar is updating when receiving the
bytes. The second time i run this project the progressbar is not updating
because the image has already been cached by internet explorer. But loading
the image takes the same time as when i run my project for the first time.
So here's my question:
Does the Loader class always downloads the image from the given url, even
when the file is cached?
Because when i just type in the url in ie the image is directly loaded.
Thanx
Richard
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development Computer software development Software design and development Macromedia flex Software development best practice
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.