Hi there,
I still get the following error:
Can not resolve a multiname reference unambiguously. flash.display:Loader(from....framework.swc(mx/controls/loader)) are available.
Please take a look at my code:
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.ProgressBar;
import mx.controls.Alert;
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.name = 'myprogress';
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);
ldr.addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, handleHTTPStatus);
}
private function handleComplete(event:Event) : void {
var myimage:Image = new Image();
myimage.width = 640;
myimage.height = 480;
var ldr2:flash.display.Loader = flash.display.Loader(event.target);
myimage.load(ldr2.content);
myvbox.addChild(myimage);
//hide progressbar when image is loaded
myvbox.getChildByName('myprogress').visible = false;
}
private function handleIOError(event:IOErrorEvent) : void {
Alert.show('file not found', 'IO error');
}
private function handleHTTPStatus(event:HTTPStatusEvent) : void {
if (event.status != 200)//200 = HTTP STATUS OK
Alert.show('HTTP error: ' + event.status, 'HTTP error');
}
]]>
</mx:Script>
<mx:Model id="persons">
<result>
<item>
<id>10</id>
<name>Richard</name>
</item>
<item>
<id>20</id>
<name>Bas</name>
</item>
<item>
<id>30</id>
<name>Dimitry</name>
</item>
</result>
</mx:Model>
<mx:VBox id="myvbox">
<mx:Button label="load" click="loadImage('http://...')"/>
<mx:ComboBox id="combo" labelField="name" dataProvider="{persons.result.item}"/>
</mx:VBox>
</mx:Application>
This results in an error:
<mx:ComboBox id="combo" labelField="name" dataProvider="{persons.result.item}"/>
This too:
<mx:ComboBox id="combo" labelField="name" dataProvider="{}"/>
And this is no problem:
<mx:ComboBox id="combo" labelField="name" dataProvider=""/>
Why? It doesn't make sense to me!
Richard
--
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.