Total Pageviews

Saturday 18 June 2011

Load and Display Image in Flash Builder 4

There are 3 methods for loading image in flash builder 4:

1) Load and Display image on Stage:


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
  xmlns:s="library://ns.adobe.com/flex/spark"
  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="500" minHeight="500" applicationComplete="loadImage()">

<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
<![CDATA[
import flash.display.*;
import flash.events.*;
import flash.net.*;
import mx.core.*;

private var loader:Loader = new Loader();
private var ui:UIComponent = new UIComponent();
private var sprite:Sprite = new Sprite();
                        private var mc:MovieClip = new MovieClip();

private function loadImage():void
{
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loader.load(new URLRequest("mypic.jpg"));
trace("started loading");
}

private function imageLoaded(event:Event):void
{
loader.width=50;
loader.height=50;
systemManager.stage.addChild(loader);
}

]]>
</fx:Script>
</s:Application>

if we want to set height width of image then set the loader height and width and than addChild the image in stage. else if we want to load image in actual size than there is no need to set the loader height and width.


2) There is an another way to load image if  you wanted to add a Flash DisplayObject to the main Application canves you would wrap the DisplayObject in a UIComponent then add the UIComponent, then add the UIComponent to the Application as a child, like this:

ui.addChild(loader);
this.addElement(ui);

3) Another way to load and display an image inside a MovieClip: 
                         
ui.addChild(mc);
this.addElement(ui);
mc.addChild(loader);

8 comments:

  1. So nice I am enjoying for that post as for u latest version of this Security tool Available
    adobe flash builder crack

    ReplyDelete
  2. Really Appreciable Article, Honestly Said The Thing Actually I liked The most is the step-by-step explanation of everything needed to be known for a blogger or webmaster to comment, I am going show this to my other blogger friends too.
    crackeyfree.com
    adobe-flash-builder-crack
    mediachance-ultrasnap-pro-crack
    folder-lock-crack

    ReplyDelete

  3. Great set of tips from the master himself. Excellent ideas. Thanks for Awesome tips Keep it up
    allsoftwarepro.com
    ideosolo-bd-dvd-ripper-crack
    mediachance-ultrasnap-pro-crack

    ReplyDelete
  4. This site have particular software articles which emits an impression of being a significant and significant for you individual, able software installation.This is the spot you can get helps for any software installation, usage and cracked.
    adobe-flash-builder-crack
    systweak-advanced-driver-updater-crack
    izotope-ozone-advanced-crack
    adguard-premium-crack

    ReplyDelete
  5. This site have particular software articles which emits an impression of being a significant and significant for you individual, able software installation.This is the spot you can get helps for any software installation, usage and cracked.
    adobe-flash-builder-crack
    systweak-advanced-driver-updater-crack
    izotope-ozone-advanced-crack
    adguard-premium-crack

    ReplyDelete
  6. This is important, though it's necessary to help you head over to it weblink: Roofers In Calgary

    ReplyDelete

Microsoft Logo using flexbox and Reactjs

 <!DOCTYPE html> <html> <head>     <script src="https://unpkg.com/react@18/umd/react.development.js" crossori...