How the loading image in as3 without XML?

Hey Hi,

Can someone help me please, I want to load image wihout using XML.

How can I do this?

Thank you


JaxNa

The only thing you need XML for is to load in a list of images... it isn't as you need. You load images and swf with a Loader object files - and there is a lot of info in the help. In short, if you can simply do:

var myLoader:Loader = new Loader();

myLoader.load (new URLRequest ("myimage.jpg"));

addChild (myLoader);

Tags: Adobe Animate

Similar Questions

  • How to check the width of the loaded image

    Hi my script loads an image like this:

    image = new Sprite();

    imageLoader = new Loader;
    imageLoader.load (new URLRequest(imageList.image[1].imgURL));
    image.addChildAt (chargeurImage, 0);

    How can I check the width of the loaded image? track (image. Width) gives 0...

    Where is the process of full load? It is not complete at the time where the code that show you is running.

    When you load external content, it takes time to load.  Your code is not wait for that to happen, he keeps just treat each line independently of the load status.

  • Is it possible to know the file name of the loaded images?

    Hello:

    I have a folder containing images named 01_image_name.jpg, 02_image_name.jpg, 03_image_name.jpg,... names that I read with a PHP script. Then I wrap each image loading and wait for all are responsible to view

    1. the PHP script reads the names file and returns a string with names separated by a "|" char, then I use the split to store in imagesNames table method and sorting
    2. I loop table of imagesNames hollow loading images
    3. anytime a new image arrives I push imagesContainer table and check if all the images are loaded to show them

    The problem is that there is no guarantee that they arrive in the same order they opposed. So, how I sorts the array imagesContainer of file name, i.e. in the same order that they are imagesNames table?

    Thanks in advance

    function imgLoaded(par:Event):void {}

    trace ("the loaded image comes from this url:" + par.target.url);

    ...

    }

  • How to load images into layers or project

    How to load images into layers or projects.  I know how to use open to open a picture, but I was looking for a way load an image to resize to fit in a specific part of a layer or load an image, then one more.

    Yes, a script would be best for what you want to do, but you might be able to do it with an action. I haven't used actions too because I prefer scripting.

  • Add the description of an xml file to the loaded image to full size

    Hi all

    I need a little help with the Gallery picture below please.

    I have a photo gallery that loads some thumbnail in via xml and AS3 support. When you click on the thumbnail, it loads the image full size in a charger.

    How can I add a description of the xml to the image full size.

    Thank you in advance for your time and effort to help me with this.

    I'm still learning a lot about AS3 and xml so your help is most appreciated people.

    It's my xml

    <?xml version="1.0" encoding="UTF-8"?>
    
    <menu>
    
        <items>
    
            <item>
    
                <url>thumb/1.jpg</url>
    
                <linkTo>fullsize\1.jpg</linkTo>
    
                <des>text I would like to appear in full image 1</des>
    
            </item>
    
            <item>
    
                <url>thumb/2.jpg</url>
    
                <linkTo>fullsize\2.jpg</linkTo>
    
                des>text I would like to appear in full image 2</des>
    
            </item>
    
            <item>
    
                <url>thumb/3.jpg</url>
    
                <linkTo>fullsize\3.jpg</linkTo>
    
                des>text I would like to appear in full image 3</des>
    
            </item>
    
            <item>
    
                <url>thumbs\4.jpg</url>
    
                <linkTo>fullsize\4.jpg</linkTo>
    
                des>text I would like to appear in full image 4</des>
    
            </item>
    
            <item>
    
                <url>thumbs\5.jpg</url>
    
                <linkTo>fullsize\5.jpg</linkTo>
    
                des>text I would like to appear in full image 5</des>
    
            </item>
    
        </items>
    
    </menu>
    

    It's my as3, I tried to take as much code that is not required in this example.

    var xmlPath:String = "pictures.xml";
    var xml:XML;
    
    var loader = new URLLoader();
    loader.load(new URLRequest(xmlPath));
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    
    function xmlLoaded(e:Event):void
    {
    
         
         if ((e.target as URLLoader) != null )
         {
              xml = new XML(loader.data);
              createMenu();
         }
    }
    
    var numberOfItems:uint = 0;
    var menuItems:Array = new Array();
    
    function createMenu():void
    {
              numberOfItems = xml.items.item.length();
    
         var count:uint = 0;
    
              for each (var item:XML in xml.items.item)
         {
    
              var imageLoader=new Loader();
              var menuItem:MenuItem = new MenuItem();
    
              menuItem.addChild(imageLoader);
              
              imageLoader.load(new URLRequest(item.url));
              
              menuItem.linkTo = item.linkTo;
              menuItem.mouseChildren = false;
              menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
              menuItems.push(menuItem);
              
              addChild(menuItem);
              
              count++;
         }
         ***();
    }
    
    function ***():void
    {
         //menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
         for (var i:uint = 0; i < menuItems.length; i++)
         {
              setChildIndex(menuItems[i], i);
         }
    }
    
    //**************************************loader for large images*************************************
    
    var loader_mc : Loader = new Loader();//loader_mc var for below itemClicked function
    
    //This function is called when a thumb is clicked
    function itemClicked(e:Event):void
    {
         var urlRequest:URLRequest = new URLRequest(e.target.linkTo);//Navigate to the URL that's assigned to the menuItem
         loader_mc.load(urlRequest);//adds the urlRequest to our loader_mc ;
    }
    
    //calling "contentLoaded" function if loading is over;
    loader_mc.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);
    
    function contentLoaded(e:Event):void
    {
         addChild(loader_mc);//adds loader_mc to the stage     
    }
    

    No, you have some already loaded in your menuItem objects with the "menuItem.des = item.des;" line of code... which means this object contains the text of actual description right here.  If you just need to assign to the textfield object that you want to use to display the description.  In my example I named it 'someTextField', but you can name but you want.  Read my other answer about which you assign this value to the TextField.

  • How to adapt the videos/images in tilelist without scrollbars

    Hello

    How to adjust and resize the number pair or uneven videos or images to tilelist without scrollbars. Any help is appreciated.

    Thank you

    Srinivas

    Hi Srinivas38,

    Cannot set the height of VariableRow for each item in the tilelist control. You will have the same height and the same width for all items.

    You have variableRowHeight for TileList as property in a List control... but it does not work... Tilelist control simply ignores the property.

    So if you want to adjust your images and videos in a TileList without scroll bars, then you must set the height and width for each item that will has the same for all the TileList components.

    Set the verticalScrollPolicy and horizontalScrollPolicy OFF for the element (which can be a file itemRenderer, you may be using).

    Thank you

    Jean Claude Chari

  • How see you the loaded image?

    Hello

    I have a ByteArray variable that contains a JPEG image and I'm looking for the best way to view it.

    I tried to get a source for the Image by setting the variable bindable, but the only result is the "broken image" icon.

    See you soon,.
    zimbatm

    Thanks, it worked, but I had to add an another event handler to wait until the charger had loaded its data: Pei

  • How sting/view images in memory without having to build the massive tables?

    I wrote a program that will capture up to 100 images, total of 500 MB.  I queue to each image (table 1 d of 12 bit) in a table of queues.  I would like to 'see' queues selectively capture data (but not destroy each queue) and display this data as a large stitched image.

    I was able to do this by building a table of each queue and manipulate rows/columns until the images are stitched in my model.  Does that create an another 500MB of memory lost since I 'copy' the queue data in another table?

    Also, is there an easier way to do this?

    Hey dre99gsx,

    IV wrote an example that seems to be the most progressive option in the construction of a large image to present its restriction to the use of grayscale (U8) and only built a training table 1 d.

    It is a requirement that you can access the separate images after that that they were sewn.

    Hope this helps

    Philippe

  • Form of the loading image of jars only once in oracle 10g

    Hello

    I have a 10g oracle forms application that loads the image of a jar. Whenever I click on a button 'A' which loads the image 'image' on another button 'B' in the same screen, a message appears in the java console "loaded image: jar: https: / / + IP + / forms/java/+myjar+.jar!/image.gif '. So after 10 clicks, I get the message even displayed 10 times. In the form, I called:
    SET_CUSTOM_PROPERTY(p_object_name, 1, 'IMAGE_NAME_ON', '/'||p_image_name);
    My question is this:
    -is it possible to load this image once and use it later without having to load each time I clik on "A"? If so, how?

    P.S.: If this thread should not be posted in this forum, please redirect me to the right.

    Thanks in advance

    In the once - new - form - Instance trigger defined visible load, button, image, then re - set button is not visible.

    François

  • How to load images with a delay?

    Let's say I have a JSON from an HTTP request. The JSON contains several JPG and text links.

    For each JPG link and text, I want that they be displayed in a field like that.

    And here is the code in the field:

    public ProductField extends Field {
    
        String text;
        Bitmap bmp
    
        public CustomField(String text, String imageURL){
            bmp = Bitmap.getBitmapResource("blank.png");
        }
    
        public void paint(Graphics g){
            //....
        }
    
        public void updateBitmap(String url){
            bitmap = BitmapUtil.loadBitmapFromURL(url);
    
            // draw the bitmap on XYRect
            dest = new XYRect(0, 0, bitmap.getWidth(), bitmap.getHeight());
            invalidate();
        }
    }
    

    I realize that load images takes time, so I don't load them immediately. I have only to load the text and display an empty bitmap in the bitmap field. The actual bitmap will be charged when the updateBitmap() method is called.

    And here's how to add these field on the screen (not a 100% valid code, but I hope you will illustrate the idea)

    VerticalFieldManager vfm = new VerticalFieldManager
    
    // an array of bitmap URLS, which will be loaded later
    final String[] urls = new String[json_array_size];
    
    for (int x = 0; x < json_array.size; x++){
        CustomField field = new CustomField(..);
    
        // store bitmap URLs in array
        urls[x] = json_array.getJSONObject(x).getString("url");
        vfm.add(field);
        vfm.add(new SeparatorField());
    }
    
    Thread t = new Thread( new Runnable() {
        public void run() {
            for(int i = 0; i < len;i += 2) {
                synchronized(UiApplication.getEventLock()) {
                    CustomField cf = (CustomField) vfm.getField(i);
                    cf.updateBitmap(urls[i]);
               }
                try{
                    Thread.sleep(2000);
                }
                catch(Exception e){ }
                }
            }
    });
    

    Seems that all the images are loaded simultaneously. What I want is something like:

    display bitmap #1-2 seconds of delay - display bitmap #2 - delay 2 sec - display bitmap #3 - delay 2 sec etc..

    How to solve this problem?

    You can remove the block synchronized as you don't make any changes to the user interface, you read a value of a UI element.
    About your son, I can't get started, maybe a start() would help. do not race

  • How to load images into memory

    I want to get the jpg of my webcam

    yesterday thanks to you

    I loaded jpg to the Simulator

    , but it has been imported to res java project

    How can I load the jpg into memory and read from the memory in the bb?

    If you know, or you know some post

    hot please answer T T

    This article will tell you how to read the jpg file in your project in memory.

    How - to add plain text or binary files to an application
    Article number: DB-00148
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/How_To _...

    Then, you must convert the bytes into something that the BlackBerry can handle.  To do this, you use:

    EncodedImage.createEncodedImage (.);

    Now you get to get a Bitmap image, whose form the BlackBerry uses to display images on the screen.  This encodedImage object, you have created in the previous step and be used to get the bitmap image, simply use the

    getBitmap()

    method

    Now, the screen BlackBerry fields on the screen, so you must create a field for display, a BitmapField and tell him to use the bitmap image that you created.  It's easy, you just build a new BitmapField:

    BitmapField (bitmap Bitmap)

    Finally, you add the BitmapField to the screen you are viewing.

    There are shorter ways to do this, if you create a png rather than jpg images.

  • How to load images synchronously

    Hi all

    I want a lot of cache images locally with URLLoader and want to know those fails. I can add event listener IOErrorEvent.IO_ERROR.

    A variable can be used to save the filename I want to load the last time. Then in the error handler, I know which file is not loaded correctly.

    However, as the images are loaded asynchronously, i.e. how URLLoader, the first loaded image can not at first filled. This means that the variable contains the wrong file name.

    Is there a better way to approach? I want to just connect the loads of the error.

    Kind regards

    Felix

    If you really want to load synchronously, just load image by image in sequence. In the Event.COMPLETE and image 1 IOErrorEvent.IO_ERROR headphones, put an invocation to load the image 2 and so on. Therefore, you can keep the order of the images.

  • The full version of the loading images

    Hello. I am trying to build a XML Gallery per inch of loading the XML file and then once the thumbs are loaded, when I click on a thumb the corresponding main image must be loaded in a mc imageContainer. I had inches to load using a loop for which makes a loop through an XMLList, but now I can not get the loading the corresponding image thumbs because I get this error message

    Error #2044: Unmanaged by the IOErrorEvent:. Text = Error #2035: URL not found.

    Maybe I messed up my references or something... Here is my code:

    var myXML:XML;

    var myImages:XMLList;

    var xmlLoader:URLLoader;

    var thumbArray:Array;

    var numberLoaded:uint = 0;

    var: padding: uint = 5;

    var thumbSize:uint = 100;

    var speed: Number = - 5;

    var n: Number;

    var touchingBar:Boolean = false;

    var thumbLoader:Loader;

    var mcThumb:MovieClip;

    var imageLoader:Loader;

    loadXML();

    function loadXML (): void

    {

    xmlLoader = new URLLoader()

    xmlLoader.addEventListener (Event.COMPLETE, sortXML);

    xmlLoader.load (new URLRequest ("gallery.xml"));

    }

    function sortXML(event:Event):void

    {

    xmlLoader.removeEventListener (Event.COMPLETE, sortXML);

    myXML = new XML (event.target.data);

    myImages = new XMLList (myXML.image);

    n = myImages.length ();

    loadThumbs();

    }

    function loadThumbs (): void

    {

    thumbArray = new Array();

    for (var i: uint = 0; i < myImages.length (); i ++)

         {

    thumbLoader = new Loader();

    thumbLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, thumbLoaded);

    thumbLoader.load (new URLRequest (myImages [i] .thumb));

    thumbLoader.x = (thumbSize + padding) * i;

    mcThumb = new MovieClip();

    mcThumb.addChild (thumbLoader);

    mcThumb.name = String (i);

    thumbArray.push (mcThumb);

    thumbContainer.addChild (mcThumb);

    TweenLite.from (mcThumb,.5, {alpha: 0, facilitated: Cubic.easeInOut});     

         }

    thumbContainer.addEventListener (Event.ENTER_FRAME, movingCode);

    thumbContainer.addEventListener (MouseEvent.CLICK, loadMainImage);

    }

    function thumbLoaded(e:Event):void

    {

    thumbLoader.contentLoaderInfo.removeEventListener (Event.COMPLETE, thumbLoaded);

    numberLoaded ++;

    if (numberLoaded == myImages.length ()) {}

    for (var i: uint = 0; i < thumbArray.length; i ++) {}

    var reflection: Reflect = new Reflect ({mc:thumbArray [i], alpha: 50, ratio: 170, distance: 0, updateTime:0, reflectionDropoff:1});})

                   }

              }

    loadFirstImage();

    }

    function loadFirstImage (): void

    {

    imageLoader = new Loader();

    imageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, addFirstImage);

    imageLoader.load (new URLRequest(myImages[0].url));

    }

    function addFirstImage(e:Event):void

    {

    imageContainer.x = (stage.stageWidth - imageContainer.width) * 0.5;

    imageContainer.y = 3;

    imageContainer.addChild (e.target.loader);

    TweenLite.to (imageContainer,.4, {alpha: 90, ease:Linear.easeIn});})

    }

    function loadMainImage(e:MouseEvent):void

    {

    imageContainer.removeChildAt (0);

    imageLoader = new Loader();

    imageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, mainImageLoaded);

    imageLoader.load (new URLRequest (myImages [e.target.name] .url));

    }

    function mainImageLoaded(e:Event):void

    {

    imageContainer.x = (stage.stageWidth - imageContainer.width) * 0.5;

    imageContainer.addChild (e.target.loader);

    }

    is there a better way to load the thumbs so that I can get better references to every inch, as for example loading them in order, then adding the click event listener to the thumb itself rather than the thumbContainer that holds all thumbs?

    Thanks in advance!

    Please define path before each URLRequest. You must have at least 4 tracks in the code in methods:

    URLRequest

    loadFirstImage

    loadFirstImage

    loadThumbs

    myImages [e.target.name] .url

    e.Target points at thumbContainer

    e.Target.Name is the name of the instance of the thumbContainer

  • How to load images dynamically in Flash

    I have a clip on the stage I want to dynamically load images in (constantly changing), how can I get it? Thank you.

    Use the Loader class to load in images.

    Then use addChild to add the class Loader in your MovieClip on the stage.

    That & quot; constantly change & quot; What do you mean by that? You can use setInterval, ther enterFrame event or any other way to trigger a new image to load into the loader instance.

    Finally, you can use the Tween class to create some nice effects for images (fade, blur in the picture mix, masks, etc.)

  • get the size of the loaded image

    Hello

    I am a series of images using loading imageLoader.load(i mage stuff) and stuffing the imageloader in a table for later reference.

    The pictures have different sizes, and I need the size position. However, using the imageLoader.loaderInfo.width gives me the width of the entire scene. How can I get the width of just the image?

    Thank you!

    Too bad, think about it. Necessary to wait for the load COMPLETE event...

Maybe you are looking for

  • Can Qosmio G20 - I install Solaris on it

    Hi Guy, I want to install Solaris on my laptop of G20 Qosmiop. I have already created two partitions on my 1st disc and I already installed WIN XP on the first Partition.So in my second Partition on the disk I want to install the Solaris x 86 operati

  • Satellite L500-1U7 - how do I clear CMOS?

    Hello everyone!I have a problem with a laptop Toshiba Satellite L500-1U7.He was blocking down by himself for a reason, and started after the reinstalling with W7 clean blue screens content poping up. I wanted to test the memory and HARD drive with so

  • Mouse event down in a table

    Hello If I use the event 'Array' the mouse down, is possible to know which element in the table was clicked? Thank you.

  • Workbook opening without voiding the warranty

    Hey My laptop (ProBook 4540 s) have always temperatures without stress. Before I could play GTA4 on high all day without BSOD. Now my flow of holes of my laptop is much smaller and hotter, and I got BSOD after 15 min. of play Deadpool or 30 min. of G

  • Display the first CC 2015 work area bar

    I just downloaded Adobe first CC 2015 and I can't find the setting to "Show work area Bar. What's in this version?