How to load and display Image

Hello everyone.

I type with very green fingers, so please excuse the question. Lessons learned from the examples, I tried to load and display an image in ActionScript. This is the original example that I work on:

...

...

var bmd2:BitmapData = bmd.clone ();

var infoBM:Bitmap = new Bitmap (bmd2);

var back: MovieClip = new MovieClip();

Back.Name = 'back ';

back.rotationX = - 90;

var bSurface:MovieClip = new MovieClip();

bSurface.y = int (...

bSurface.z = int (...

bSurface.addChild (infoBM);

var overlay: Sprite = new Sprite();

overlay.graphics.beginFill (...);

overlay.graphics.drawRect (0, 0, bSurface.width, bSurface.height);

overlay.graphics.endFill ();

bSurface.addChild (overlay);

back.addChild (bSurface);

var tf:TextField = new TextField();

TF...

TF...

TF...

bSurface.addChild (tf);

...

...

I'm trying to place an image on the bSurface instead of the block of text, as described above. So far, I came with:

var iSprite:Sprite = new Sprite();

var iMatrix:Matrix new matrix());

var bmData:BitmapData;

bmData = new BitmapData (surface.width, surface.height, true, 123);

var loader: Loader = new Loader();

loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete);

Loader.Load (new URLRequest("c:\pixlr.png"));)

function onComplete (event: Event): void

{

bmData = Bitmap (content LoaderInfo (event.target)) .bitmapData;

}

iMatrix.tx = 0;

iMatrix.ty = 0;

iSprite.graphics.beginBitmapFill (bmData, iMatrix, false, true);

iSprite.graphics.drawRect (0, 0, surface.width, surface.height);

iSprite.graphics.endFill ();

surface.addChild (iSprite);

... and:

var bmData:BitmapData;

bmData = new BitmapData (surface.width, surface.height, true, 123);

var loader: Loader = new Loader();

var location: URLRequest = new URLRequest ("c:\pixlr.png");

Loader.Load (rental);

bmData = Bitmap (loader.content) .bitmapData;

surface.addChild (bmData);

but without success. I've been fails miserably for days now and would appreciate help.

Thanking you in advance,

Sofia.

what you trying to do?

If you just try to load an image (pixlr.png), use a relative path and something like:

var loader: Loader = new Loader();

Loader.Load (new URLRequest ("pixlr.png"));  put the png in the same directory with your fla and published files.  You can move after getting this work simpler example

addChild (loader);

Tags: Adobe Animate

Similar Questions

  • How to load and place images dynamically

    I have a problem with loading images dynamically. I want to import a series of images and the display in the order across the screen. The images will have different widths, so it is important to know the width of each imported image as IM will place an image immediately to the right of the previous image. I thought that the code below would control the presentation, but the event handler seems to work (perhaps partly because the images are different sizes) not well.

    What should I do to control the positioning of the images?

    Thnks a lot.

    XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"creationComplete =" init () "> "
    < mx:Script >
    <! [CDATA]
    Mx.events import. *;
    private var imageLoader:Loader
    private var imageX:Number = 0;
    public void init (): void {}
    for (var i: int = 0; i < 4; i ++) {}
    imageLoader = new Loader();
    var url: String = "images/animal" + i + ".png";
    var urlReq:URLRequest = new URLRequest (url);
    imageLoader.load (urlReq);
    trace ("image =" + URL)
    container.addChild (imageLoader);
    imageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);
    }
    }
    public void imageLoaded(e:Event):void {}
    imageLoader.x = imageX;
    trace ("imageloader.x =" + e.Target.Width);
    imageX += e.target.width
    imageLoader.y = 100
    }
    []] >
    < / mx:Script >
    < mx:UIComponent id = "container" / >
    < / mx:Application >

    Unless I'm mistaking completely your goal, you do the way of things too hard on yourself.

    Install a HBox and addChild() to add images to that:

    (I made a few changes to make it work for me locally in order to do not copy/paste).

         
              
         
    
         
    

    In addition, you need to use the charger because it has other ways to load images, e.g., you can create a new Image, as I do above and set the source property to the path of the file, or you can embed images, but I guess that is not an option.

  • How to read and display a my a miccrontroller (MCB1700) on labview signal connected via a port on a PXI machine CAN

    How to read and display a my a miccrontroller (MCB1700) on labview signal connected via a port on a machine PXI CAN?

    I tried using a DAQ Assistant, but the port is not included as one of the physical channels supported, even if all his drivers are up to date.

    Help, please...

    Thank you.

    If you can read it in MAX, then you should be able to run the NI CAN example.

    Help-> find examples

    Find the CAN and watch CAN Receive.vi.

    Basically, set up the network, open the object, read in a loop close object when it is done.

    If you have any questions about the example, go ahead and post your vi and we can work from there.

  • T510 HP - do not click on Flash videos, they do load and display if

    Hello

    The device in question is a version of the device T6X43202 t510 HP

    When it is connected to Citrix video flash will load and display correctly, but you can not click on them.  It seems that the mouse downwards is not detected by the flash video.  You can TAB through it and use the keyboard to navigate through the video.

    For the specific Web site, that I need to run I went on the server instead of forwarding to the client.  All other TC models work very well but not the t510.

    It is not a problem with a specific site either, it happens on all flash videos.

    Any ideas?

    I ended up doing back to HP ThinPro 41019 that isn't the question.

  • How to load a scanned image to facebook?

    How to load a scanned image to facebook?

    I don't know, but I'm sure that the answer will not associate Adobe Reader.

  • How to load and loading movies.

    Guy

    I want to know how to load and unload a movieclip.

    Like for example I have a map of the uk in my swf and when no matter what body, click on map(say_london).the current map should disappear and new larger version of the london must be loaded on another swf and need to get first (orginal card) when he clicks back button.

    Please help me

    Thank you

    Madhu Nevarsin Magar

    Nepal

    Take a look at the class Loader or component UILoader to load a SWF file.

  • Direct access and display image problem

    I'm doing a small application for playbook, I want to make the user able to browse images and display it in our application when they selected. I m using flash builder 4.5 sdk. I used the following code.

    protected function btn_Browse_clickHandler(event:MouseEvent):void
    {
    TODO self-generating method stub
    var file:File = File.userDirectory;
    file.addEventListener (Event.SELECT, dirSelected);
    file.browseForOpen ("select a directory");
    function dirSelected(e:Event):void
    {
    trace (file.nativePath);
    lbl_Test.text = file.nativePath;
    leader. Canonicalize();
    ImageURL = file.nativePath;
    Img_Thumbnail.source = file.nativePath;
    }

    }

    When I click on the Browse button "Open dialog box appears", I select the image, but when I click on the Open button in the open dialog box, you have to show the image. but it does not show the image.

    What is the problem? and how to solve this problem. Can someone tell me...

    Do you have
    access_shared
    set in your file to blackberry - tablet.xml?

  • How to load and object to read a file in CC Json animate?

    I'm a little puzzled about how to load an external Json file and have for example a text box display the Json file information.

    I'm used to make this way on the edge, but how the cabin = n I do this with the new animate CC 2016?

    Thanks a bunch,

    SAL

    Here is the code example:

    var LQ is new createjs. LoadQueue (true);

    lq.addEventListener ('complete', completeF);

    lq.loadFile ({id: "json", CBC:"test.json"});})

    function completeF (event) {}

    JSON = event.target.getResult ('json') var;

    parseJSONF (json);

    }

    function parseJSONF (obj) {}

    for (^ s in obj) {}

    {If (typeof {obj [s] = 'object'})}

    parseJSONF (obj [s]);

    } else {}

    Console.log (s + ': ' + obj [s])

    }

    }

    }

  • How to incorporate and display a SWF in a Flex application.

    Hi all

    I'm trying to embed a swf animation in a flex 4.5 application and display it, but it does not work!

    I get error after error.  When I try to use addElement(), I get the following error:

    1067: coercion of a value of type mx.core:MovieClipLoaderAsset to an unrelated type mx.core:IVisualElement.

    If I use addChild(), then he throws another error when running.

    Here is my code:

    [Embed(source="assets/con_mov.swf")]
    private var connectMov:Class;
    private var conMov:MovieClipLoaderAsset = new connectMov();
    

    Here's the code I'm trying to use it to displey:

    borderContainer.addElement(conMov);
    

    I tried just to add to the application using this.addChild (connectMov), but I get an error during execution.  It's ridiculous!  Bringing a swf created in Flash into Flex and displaying should not require so much effort - IMHO.  There is a lot of documentation on how to embed a swf in Flex, but almost nothing about how to post!

    It's just a simple animation placeholder so I need access to all the functions on the inside, I want to integrate rather than using swfLoader.

    Thanks for any help or advice you can give!

    Matt

    Hello Matt,

    Yes you are right, it is not necessary to set the source of the image that we add a movieclip with swf. It was a mistake in my

    code, because I have tried it with too many crazy ways.

    Now the SWFLoader, ABT

    This technique works well with the SWFs that adds a graphical application or animations, but are not intended to have a large amount of interaction with the user. If you import SWF files that require a large amount of user interaction, you must build them as custom components. (Adobe Docs)

    Thank you and best regards,

    ---------------------------------------------------------------------- ----------------------------

    Kanchan Ladwani | [email protected] | www.infocepts.com

    ---------------------------------------------------------------------- ----------------------------

  • How to load and you unsubscribe contacts of the group e-mail to the E10?

    I know how to load new contacts and worldwide unsubscribe them but I'm trying to figure out how to unsubscribe them only to the Group an email because we have several brands. Someone knows how to do this in E10? Thank you

    Hi Rebecca

    One way I've seen to do would be to put everyone in a list shared during the download.

    Then, build a small program that has a stage for them to unsubscribe from the campaign. Add the list shared in the program and this will be done.

  • How to load and Preview app?

    I followed all the steps described in the User Guide and built a test application... followed all the steps to sign. I'm back where I want to load it and post it on my devices iOS and need help.

    This is my first build of the app; the Guide says Adobe "use iTunes, Xcode or another method to load the application signed to your iOS device.

    1. can anyone recommend a tutorial online for this step? I don't know how to load the software for an overview with iTunes or Xcode.

    My application is signed - and I got the message that the signed copy is stored next to the unsigned signature tool App publication Adobe copy.

    2. where does it save these files? If the application is built in the cloud, where is the signed app files?  The publish.adobe.com/appbuilder screen still shows my application as an "application not signed."

    Thanks for any help.

    Hello

    To find out how to load the signed applet (.ipa) on the device iOS through iTunes, please refer to the "Installation of your App on Test Devices" section on this page Apple Developer.

    The Adobe Digital Publishing Solution platform only stores the version unsigned app. The signed app generated by the signature publication Adobe App tool will be local on your computer, in the same directory that the unsigned application has been downloaded. that is, if the unsigned application has been downloaded to the default of 'Download' folder, then the signed app (with the suffix "-signed") will also be in the "Download" folder

    -Mike

  • How to read and display the .ai file in CS4 SDK?

    Hi all

    I drew an own and saved the socument as file traingle.ai.

    Now, I want to read/open the traingle.ai file in the plugin.

    [Lets say, I want to read this file based on GoFilter ()]

    Is there an API to read file .ai in CS4 SDK? and display as well?

    If you mean autonomous (outside Illustrator) the answer is no. The SDK is reserved for the plugins loaded into Illustrator. If you want to open a file from Illustrator that is perfectly doable if. I think that AIDocumentList:: open() that will handle.

  • How to retrieve and display the image on screen stored in pim...

    Hello world

    Can anyone tell how to recover the image store in pim and then display it on the screen

    See the code below. I just copied it from PIM API doc

     import java.io.IOException;
     import javax.microedition.pim.Contact;
     import javax.microedition.pim.ContactList;
     import javax.microedition.pim.PIM;
     import javax.microedition.pim.PIMException;
     import javax.microedition.pim.PIMItem;
     import net.rim.device.api.io.Base64InputStream;
     import net.rim.device.api.io.Base64OutputStream;
    
     public class PhotoExample
     {
    
         private Contact _contact;
    
         public PhotoExample() throws PIMException
         {
             ContactList contactList = (ContactList) PIM.getInstance().openPIMList(
                     PIM.CONTACT_LIST, PIM.READ_WRITE );
             _contact = contactList.createContact();
         }
    
         public void setPhoto() throws IOException
         {
             byte[] photo = getSamplePhoto();
             byte[] photoEncoded = Base64OutputStream.encode( photo, 0,
                     photo.length, false, false );
             if( _contact.countValues( Contact.PHOTO ) > 0 ) {
                 _contact.setBinary( Contact.PHOTO, 0, PIMItem.ATTR_NONE,
                         photoEncoded, 0, photo.length );
             } else {
                 _contact.addBinary( Contact.PHOTO, PIMItem.ATTR_NONE, photoEncoded,
                         0, photo.length );
             }
         }
    
         public byte[] getPhoto() throws IOException
         {
             if( _contact.countValues( Contact.PHOTO ) > 0 ) {
                 byte[] photoEncoded = _contact.getBinary( Contact.PHOTO, 0 );
                 return Base64InputStream.decode( photoEncoded, 0,
                         photoEncoded.length );
             } else {
                 return null;
             }
         }
    
         private static byte[] getSamplePhoto()
         {
             // return the raw bytes of the photo to use
         }
    
         public static void main( String[] args ) throws Throwable
         {
             PhotoExample example = new PhotoExample();
             example.setPhoto();
             example.getPhoto();
         }
    
     }
    

    .

  • How to download and see images of a disk

    original title; I have my brain MRI on disk. You want to download & view photos. Windows 7 Home Premium 64-bit

    I am familiar with Windows Media Center, etc. and need someone who can speak of 'Computer for Dummies', explain to me how to download the images... where to put the (photos, video, etc.) and how to access the images. I am post cancer and I have chemo brain. I need instructions in a few simple steps... (1) - this, then, 2) - to... etc. Not that I really understand what I look at you, but no one type am very curious. Would appreciate sincerely any help out there, can someone give me. mlcook16 thank you.

    The MRI I have for my wife is on CD that starts automatically when you insert the disc in the drive.  It's about as simple as that.

    It's also to copy the contents of the CD to your hard drive, but it requires a little smarter computer.  You can click on Start-> computer to bring up the tool, you will need.  Then put the CD in the drive.   After that, it loads the CD you can return to the task of the computer and click on the drive letter for the CD in the left pane.  Then click on anything in the right pane.  Hold down the CTRL key and press A.  This operation copies the contents of the CD to the Clipboard.  At this point, you will need to create a folder on your computer to put the files.  In the left pane of the computer, scroll to Documents, and click on it.  Hold down the ALT key and press F.  In the upper left corner, point to NEW, and click FOLDER.  Now type the name you want to call the folder (for example my MRI) and press ENTER.  Right click on the new folder and click COPY.  This will copy the contents of the CD-ROM to this folder.   Once copied, you will need to find the main program to display the data and double-click it to start.

    Now don't you believe that it would be easier to just put the CD in the drive to view the contents?  :-)

    Good luck.

  • How to load external png image via xml?

    Can someone help me with the addition of a png image to a mc with an instance name.

    I want only to display a single image (no Gallery)

    I would like to get the url of the image via an xml.

    Here's a copy of my current action script which has already pulled in xml data that includes the node with the url of the photo.

    import flash.events.Event;

    import flash.events.MouseEvent;

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    var myXML:XML;

    var myLoader:URLLoader = new URLLoader();

    myLoader.load (new URLRequest ("links.xml"));

    myLoader.addEventListener (Event.COMPLETE, processXML);

    function processXML(e:Event):void

    {

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

    trace (myXML);

    menumv.carbtn.addEventListener (MouseEvent.CLICK, openCURL);

    menumv.edubtn.addEventListener (MouseEvent.CLICK, openEURL);

    menumv.psybtn.addEventListener (MouseEvent.CLICK, openPURL);

    menumv.stubtn.addEventListener (MouseEvent.CLICK, openSTURL);

    menumv.busbtn.addEventListener (MouseEvent.CLICK, openBURL);

    menumv.shabtn.addEventListener (MouseEvent.CLICK, openSURL);

    studentmv.stuname.Text = myXML.student.name;

    }

    function openCURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.car.url));

    }

    function openEURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.edu.url));

    }

    function openPURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.psy.url));

    }

    function openSTURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.stu.url));

    }

    function openBURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.bus.url));

    }

    function openSURL(e:MouseEvent):void

    {

    navigateToURL (new URLRequest (myXML.sha.url));

    }

    And here's a copy of the node that contains the url

    <menu>
        <student>
        <name>testnamehere</name>
        <photo>http://10.0.0.2/test/photos/testnamephoto.jpg</photo>
        </student>
    </menu>
    

    I saw this tutorial but it was for a gallery, and I couldn't not to hack and slash to do what I want.

    http://Tuts.flashmint.com/creating-a-simple-XML-Gallery-in-ActionScript3/

    Thanks again in advance for any help.

    Check if this gives null if yes it would output menu.student.photo

    trace (Student.photo)

    var _request:URLRequest = new URLRequest (student.photo);

    var _ldr = new Loader();

    MC's movieclip where you add your image

    mc.addChild (_ldr);

    _ldr. Load (_REQUEST);

    _ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, load_complete, false, 0, true);

    function load_complete (event): void

    {

    whatever it is may be melted in the image

    }

Maybe you are looking for

  • HP compaq presario cq57: bios password

    Hello I need to format my laptop but when I enter the bios, I get a password lock HP compaq cq57 bios password code 70143291 kindly to reset the password so that I can continue Thanks in advance

  • Oscilloscope for the acquisition of data from the usb-6009 or - example of temporal division for 5 seconds, 10 seconds

    Hey Hey everyone I was looking for an example for two-channel oscilloscope virtual using e/s all-in-one of the 14 bits of NI DAQ USB 6009. I tried to research for example BOF time division or s/div for 1 second, 5 seconds, 10 seconds.  but was shocke

  • Service Pack

    I've been running Windows 7 for a few days now.  Should I install Vista Service Pack 1 and 2?

  • His works on laptop but the headphones don't

    Hello I spent the last few hours LURKING through forums to try to solve this problem, but I have not thought about it then it is my last chance before I lift my hands upwards!  I have a laptop hp Compaq nc6220 I bought a refurbed just a week ago (but

  • How can I check my PC for malware and spyware?

    I tried to pay for my subscription to Rolling Stone mag online and when I accessed their website I was attacked at least six viruses and every time I tried to hit the isolate or remove the button the screen change then he said my PC has been fixing c