Hello,

you could load images dynamically from a given url.

what you need to do is make a new url request and use a loader :

public function setImage (AnImageSource : String) : void
{
        var request:URLRequest = new URLRequest(AnImageSource);
        var imageLoader:Loader = new Loader();

imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, 
onFrameReceptionComplete);
        imageLoader.load(request);
}

then on reception complete :
private function onFrameReceptionComplete (event : Event) : void
{               
        originalFrameBitmap = Bitmap(event.currentTarget.content) ;     
        this.addFrame() ;               
}

Now you have a Bitmap object containing your image. 

Remember that the flash player needs an authorization to access stuff at 
addresses different than his address, so you'll have to add a xml configuration 
file called crossdomain.xml at the root of your image folder.

Good luck
--- In flexcoders@yahoogroups.com, sony antony <pow_like_me...@...> wrote:
>
> Hi friends,
> 
> Is there any way that we can embed an image dynamically through action 
> script??
> 
> If I do, it as given below,
> 
> [Embed (source='../assets/image/icon.jpg')]
>         public var myImage:Class;
> 
> myButton.setStyle("backgroundImage",myImage);
> 
> 
> It works fine..
> 
> But this button is created dynamically, and there are number of buttons 
> created in one container. 
> This button is a custom class too.. and I need different images to each 
> button, that is what my requirement is.. 
> 
> any suggestion from any of you friends..??
> 
> Thanks and Regards,
> Sony.
>


Reply via email to