How to load external png image via xml?

Can anyone help me with adding a png image to a mc with an instance name.
I only want to display a single image (no gallery)
I would like to get the url for the image via an xml.
Here is a copy of my current action script which has already pulled in the xml data which includes the node with the url for 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 is a copy of the node containing the url
<menu>
    <student>
    <name>testnamehere</name>
    <photo>http://10.0.0.2/test/photos/testnamephoto.jpg</photo>
    </student>
</menu>
I did see this tutorial but it was for a gallery and I couldnt seem to hack and slash it to do what I want.
http://tuts.flashmint.com/creating-a-simple-xml-gallery-in-actionscript3/
Thanks again in advance for all the help.

I have added that code but I think i have buggered up something else in the process.
I get the following error
ReferenceError: Error #1069: Property data not found on flash.display.LoaderInfo and there is no default value.
    at sdp_fla::MainTimeline/load_complete()
Current AS
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;
var _request:URLRequest = new URLRequest(myXML.student.photo);
var _ldr = new Loader();
studentmv.photo.addChild(_ldr);
_ldr.load(_request);
_ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, load_complete, false, 0, true);
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));
function load_complete(event):void
var bitmap:Bitmap = Bitmap(event.currentTarget.data);
bitmap.smoothing = true;
bitmap.width = studentmv.photo.width
bitmap.width = studentmv.photo.height
studentmv.photo.addChild(bitmap)

Similar Messages

  • How to load a PNG image from a location in CF card

    Hi,
    I am using WTK 2.5.2. I wanted to load a PNG image to Image object. The image is loaded when I have it in the classes folder. But I want to select different image from a different location. If I try to open an Image to createImage(String) from a different location, I get IOException.
    Please help me.
    Thanks
    Deekshit M

    I got the answer, I should be using Image.createImage(InputStream) API. It works fine.
    Thanks
    DM

  • Loading external png

    Could someone show me a sample script of how to load several external png images in to a movieclip using a click action.
    E.g.
    IMAGE 1 should appear in present_mc when PARI_BTN is clicked
    IMAGE 2  should appear in present_mc when LOND_BTN is clicked.
    IMAGE 3  should appear in present_mc when newy_BTN is clicked.
    so on...

    If you look into the Loader class in the help documents, there are examples there as well as explanations of all the properties and methods.  A basic set of code for what you want to do would be something like:
    var ldr:Loader = new Loader();
    var url:String = "yourimage.png";
    var urlReq:URLRequest = new URLRequest(url);
    ldr.load(urlReq);
    present_mc.addChild(ldr);
    You will probably find several explanations in this forum as well if you do a little searching.

  • How to load a boot image to cisco aironet 1140 series after missing boot image

    Hi all,
    I need a solution for this. When i switch my cisco aironet 1140 , it s blinking with red light .and gives a message "no boot image to load".
    When i tried next time, by pressing escape it shows this message that i have mentioned below.
    ap:
    ap:
    using  eeprom values
    WRDTR,CLKTR: 0x83000800 0x40000000
    RQDC ,RFDC : 0x80000035 0x00000208
    using ÿÿÿÿ ddr static values from serial eeprom
    ddr init done
    Running Normal Memtest...
    Passed.
    IOS Bootloader - Starting system.
    FLASH CHIP:  Numonyx P33
    Checking for Over Erased blocks
    Xmodem file system is available.
    DDR values used from system serial eeprom.
    WRDTR,CLKTR: 0x83000800, 0x40000000
    RQDC, RFDC : 0x80000035, 0x00000208
    PCIE0: link is up.
    PCIE0: VC0 is active
    PCIE1: link is NOT up.
    PCIE1 port 1 not initialized
    PCIEx: initialization done
    flashfs[0]: 1 files, 1 directories
    flashfs[0]: 0 orphaned files, 0 orphaned directories
    flashfs[0]: Total bytes: 32385024
    flashfs[0]: Bytes used: 1536
    flashfs[0]: Bytes available: 32383488
    flashfs[0]: flashfs fsck took 16 seconds.
    Reading cookie from system serial eeprom...Done
    Base Ethernet MAC address: 28:94:0f:d6:c8:62
    Ethernet speed is 100 Mb - FULL duplex
    The system is unable to boot automatically because there
    are no bootable files.
    C1140 Boot Loader (C1140-BOOT-M) Version 12.4(23c)JA3, RELEASE SOFTWARE (fc1)
    Technical Support: http://www.cisco.com/techsupport
    Compiled Tue 18-Oct-11 14:51 by prod_rel_team
    ap:
    So , now my question is how to load the boot image ? From where will we get this ? OR
    I m also having another Cisco aironet 1140 , Can i get bootimage from that . Kindly let me know the solution from genius ?

    Take a look at this link as it should have the info you need
    https://supportforums.cisco.com/docs/DOC-14636
    Sent from Cisco Technical Support iPhone App

  • How to load external storage html file in web view

    hi all,
        how to load external storage html file in web view, please help me
       " ms-appdata://local/index.html" not working
    veerasuthan veerakesan

    It need be read as string. Then load the string by  Webview.NavigateToString.
    Sample as below
    string htmlstring = string.Empty;
    try
    var htmlfile = await Windows.Storage.ApplicationData.Current.LocalFolder.OpenStreamForReadAsync("a.html");
    using (System.IO.StreamReader streamReader = new System.IO.StreamReader(htmlfile))
    htmlstring = streamReader.ReadToEnd();
    webview.NavigateToString(htmlstring);
    catch(Exception ex)
    Debug.WriteLine(ex.ToString());
    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

  • I have a problem with loading the PNG image

    I have a problem with loading the PNG image from site. For ex. go to icefilms com and is starts to load png like crazy CPU is huge and you can not shut down Firefox at least a minute. This is not just in this site but whit any one whit lots of pictures.
    Image from firefox: Picture [http://img836.imageshack.us/img836/9910/7312011103147pm.jpg 1] [http://img28.imageshack.us/img28/8505/7312011103249pm.jpg 2] [http://img706.imageshack.us/img706/5615/7312011103348pm.jpg 3 ][http://img827.imageshack.us/img827/8483/7312011103533pm.jpg 4]
    This is my Task Manager [http://img217.imageshack.us/img217/5715/7312011103621pm.jpg 1]
    - I try safe mode, same thing
    -All addons and plugins are ok
    Any idea why is this so big problem.

    i did both of them, but still the while sending the mail the diolog box is not showing up and also the spelling and grammer does not do the spelling check. 
    This problem just started for about 3 to 4 days now.  earlier it was working normally.

  • How to turn off PNG Images

    How to turn off PNG Images?

    PNG is a format for (compressed) images just like the JPG format. There is no way to disable this format.
    If you have a problem with images on some web pages then you may need to block images from some domains.
    You can look at the Adblock Plus extension to block specific content.
    * Adblock Plus: https://addons.mozilla.org/firefox/addon/adblock-plus/
    You need to subscribe to a Filter list (e.g. the EasyList).
    * http://adblockplus.org/en/subscriptions
    * http://adblockplus.org/en/getting_started

  • How to stream a png image from a Servlet to an Applet?

    Hello,
    I'm trying to write to an output stream (in my servlet) a png image created with JFreeChart library and read it from an input stream (in my applet).
    So,i'm using
    response.setContentType("image/png");
          response.setBufferSize(1000000);
          ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
          System.out.println("starting writing image object");
          this.genPNG(chart);
          ChartUtilities.writeChartAsPNG(out, chart, 729, 447);On the applet side i'm trying to read the input stream with ImageIO.read(InputStream)
    InputStream in = servletCon.getInputStream();
          //Image case
          ObjectInputStream objInputStream = new ObjectInputStream(in);
          Object o = objInputStream.readObject();
          Image img = ImageIO.read(objInputStream);
          im = new ImageIcon(img);But nothing happens.It returns me a null object.
    On the servlet side if i write the image on disk it's ok.(This means that the servlet is doing correctly it's job of writing the image).
    Do you have any ideas and possibly 2-3 lines of code on how to write a png image in a stream and how to read the stream +reconstruct the image.
    I searched a lot but not found anything (there's something out there for jsp only).
    Thanks you in advance
    Chris

    You're right.I forgot those Object Streams because i was passing another serialized object which wasnt serializable,then i changed by passing the complete image but forgotten those streams.
    It worked gracefully with simple Input Output Streams and ImageIO.
    Thank you very much
    Chris

  • Loading Single Image Via XML

    Hey guys, I am trying to load a single image on to the stage via an xml file.
    Here is my xml file
    <?xml version="1.0" encoding="utf-8"?>
        <pictures>
            <pic>image1.jpg</pic>
        </pictures>
    I'm trying to figure out the actionscript 3 code but I don't know how to code it.
    If someone can please point me to the code or tutorial, it would be much appreciated.

    You would load the xml by doing this:
    var req:URLRequest = new URLRequest("xmlfilename.xml");
    var ldr:URLLoader = new URLLoader();
    ldr.addEventListener(Event.COMPLETE,xmlLoaded);
    ldr.load(req);
    function xmlLoaded(e:Event){
      var xml:XML = XML(e.target.data);
    //see * below..
    * then the code to load the image could go in the xmlLoaded function (in place of that //see below line), and would look like this:
    var imgreq:URLRequest = new URLRequest(xml.pictures.pic[0]);
    var imgldr:Loader = new Loader();
    imgldr.load(imgreq);
    addChild(imgldr);
    Normally you might add a listener to the Loader's contentLoaderInfo, so that you could then size or position the image before adding it to the stage. But hopefully the above code would get you as far as having the image in the top left of the stage.
    Read up more on Loader, URLRequest, URLLoader, and XML, to get a sense of the various parts of the whole process.

  • How to load external XML into DataGrid ??

    Hello ,everybody , I can't load external Xml like this format
    <list>
    <month name="Jan-04" revenue="400263" average="80052">
    <region name="APAC" revenue="46130"/>
    <region name="Europe" revenue="106976"/>
    <region name="Japan" revenue="79554"/>
    <region name="Latin America" revenue="39252"/>
    <region name="North America" revenue="128351"/>
    </month>
    <month name="Feb-04" revenue="379145" average="75829">
    <region name="APAC" revenue="70324"/>
    <region name="Europe" revenue="88912"/>
    <region name="Japan" revenue="69677"/>
    <region name="Latin America" revenue="59428"/>
    <region name="North America" revenue="90804"/>
    </month>
    </list>
    I only can load with node format like this :
    <order>
    <item>
    <menuName>burger</menuName>
    <price>3.95</price>
    </item>
    <item>
    <menuName>fries</menuName>
    <price>1.45</price>
    </item>
    </order>
    Please tell me what am I going to do?
    Thanks!

    I'm stuck on this as well. I've read through the above
    samples and postings and am now feeling really retarded. I thought
    throwing the contents of a simple XML doc into a DataGrid would be
    easy, but I've been trying all morning and no love. Any help is
    appreciated.
    Here the XML --> guides.xml
    <?xml version="1.0" encoding="UTF-8">
    <GuideList title="Current Guides">
    <GuideItem>
    <GuideName>11699240</GuideName>
    <DisplayName>Supercharged Branding
    Program</DisplayName>
    <LinkText>View Downloadable Guide</LinkText>
    <Franchise>Film/TV</Franchise>
    <Property>Cars</Property>
    </GuideItem>
    <GuideItem>
    <GuideName>11721503</GuideName>
    <DisplayName> Packaging & Retail
    Signage</DisplayName>
    <LinkText>View Downloadable Guide</LinkText>
    <Franchise>Film/TV</Franchise>
    <Property>None</Property>
    </GuideItem>
    etc....
    Here's the flex --> GuideListDisplay.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" initialize="guidelist.send()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable] private var myData:ArrayCollection;
    private function resultHandler(event:ResultEvent):void {
    myData = event.result.GuideList.GuideItem;
    ]]>
    </mx:Script>
    <mx:HTTPService id="guidelist" url="assets/guides.xml"
    result="resultHandler(event)"/>
    <mx:Panel title="{myData.GuideList.title}"> // 1119
    <mx:DataGrid x="29" y="36" id="Guides"
    dataProvider="{myData.lastresult.GuideList.GuideItem}"> // 1119
    <mx:columns>
    <mx:DataGridColumn headerText="Guide Number"
    dataField="GuideName"/>
    <mx:DataGridColumn headerText="Guide Name"
    dataField="DisplayName"/>
    <mx:DataGridColumn headerText="DisplayText"
    dataField="LinkText"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Panel>
    </mx:Application>
    The lines throw with // 1119 throw a problem notice - 1119:
    Access of possibly undefined property GuideList through a reference
    with static type mx.collections:ArrayCollection.
    GuideListDisplay.mxml Lessons line 17 March 21, 2007 12:53:45 PM
    215
    Please help before hari kari looks like a good option.
    Thanks!

  • How to load a tif image in flex

    Hi All,
    Is it possible to load a tif image in flex. If it's possible
    anyone guide me or send me some code snippets regarding how to
    display a tif image in flex.
    Regards,
    Dharma

    "flexdharma" <[email protected]> wrote in
    message
    news:ga2d96$p8h$[email protected]..
    >
    Hi All,
    > Is it possible to load a tif image in flex. If it's
    possible anyone guide
    > me or send me some code snippets regarding how to
    display a tif image in
    > flex.
    Convert it to the much more web-friendly png format.

  • Loading external png with transperancy

    Hi,
    Im trying to create an as3.0 navigation with a few buttons.
    Each button is a png image.
    When im importing images to the stage i dont have any transperancy issues but the problem is that they are not smooth enough, especially
    because im animating them using TweenLite.
    I thought that the only way to do it properly is to load all the images using as3 into bitmap objects and then use the smoothing property.
    The problem is that everytime that i assign the png to a bitmap object i lose the transperancy information and i get a white background...
    Anyone knows how can i keep the transperancy information from the png onto the bitmap object ?
    Thanks

    Here's a bit of code that loads a png with transparency, smooths it, and places it on stage.
    var a:Loader = new Loader();
    a.load(new URLRequest("spider.png"));
    a.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    function done(e:Event){
        var bit:Bitmap = e.target.content;
        if(bit != null){
            bit.smoothing = true;
        addChild(bit);

  • How to load svg (vector) image dinamicaly.

    Hallo!
    I tryed to load dinamicaly an image svg (.ai) into flash but I can't.
    At my level:
    1) I know that flash can't import .svg file but it is possible convert svg in Adobe ilustrator .ai file;
    2) I can import .ai file in flash with no problem;
    3) I can load dinamicaly external  .jpg file with no problem;
    If I try to load dinamicaly  .ai file in the same way that I use to load  .jpg file I get this message:
    Error #2044: Unhandled ioError:. text=Error #2124: Loaded file is an unknown type. URL: file: .....
    Is there any way to solve this problem?
    Can someone help me?
    Thank you.

    you can use the urlloader class to load the svg but it won't display an image until you parse the xml, Using SVG as a level design format - Zeh Fernando

  • How to load use an image library in the portal pages

    Hi,
    How to load an image library in the portal ? Do I need to load images in an Apache directory and access them via URLs, or do I need to upload images to a specific portal page, and access these images via specific URL ?
    Thanks for your help,
    Jean-Christophe

    Another easy method is to create a dedicated page in Portal and use it for the storage of images, flash objects.
    Load the images as item type FILE and use the 'direct access' method (HOST:PORT/pls/<DAD>/docs/PAGE/<PG NAME>/<PAGE_NAME>/IMAGE.GIF)to access the file from a URL command.
    This way all your images are protected in the database, easy to add and find (via search or by adding descriptions, categories etc) via role based security and in theory should be quicker to access (via the URL) due to the indexing capabilities of the database.
    Place the images in a location that is not going to cause a page navigation issue such as in its own Page Group or as sibling page to your top level parent page etc.
    Hope this helps.
    John

  • How can I add .PNG images to templates without getting a white background?

    I'm having problems with a image field when I add a .png image which doesnt have a background it is showing up with a white background. Is it possible to use images in templates so you can overlay them on something else?

    Hi, You can do this but only with a PNG with a palette of 256 colors (maybe GIF as well) so doesn't get a lot of use, good enough for image buttons and the like, but might be ok for your image as it does not have that many colors. Otherwise radzmar's suggestion would be the better approach.
    This is the link I was tring to find (in your previous thread) that tells how to do it using GIMP (a free image editor), http://smartforms.business.gov.au/DeveloperResources/Pages/HintsandTips.aspx ,  but the one I have uploaded here comes from photoshop (in photoshop it is called an indexed png).
    Regards
    Bruce
    p.s. I'm always on the lookout for a new beer to try if this one you would recommend? 3% and all.

Maybe you are looking for

  • Help with setting a MDX goal expression in SSAS

    Our data is updated monthly and the last date of available data can be anywhere from 45-75 days behind.  For example, data is current through 6/30/2014 as of 8/25/2014. I have a Time dimension hierarchy named [Calendar] with [Year]>[Half Year]>[Quart

  • Nomad Jukebox Zen Xtra firmware prob

    I tried to upgrade the firmware and now my Xtra is in Rescue Mode. None of the updates that I downloaded from the website area all telling me that no device is detected. But my computer recognizes my Xtra. I tried downloading everything again but tha

  • Reporting on DSO for Broker's Statement (Line Item Reporting)?

    Dear experts, I need to create a BW report based on data from FS-CD and ICM for a client in the insurance industry. The report is broker's statement which has in total 3 sections/pages (or in 3 levels). The requirements are as follows: 1. Overview of

  • Message Driven Bean example

    Hi I am looking for pointers in building a MDB Bean, pointers in this regard, will be of great help. Thanks sunder

  • IPhone Config Issue with Cox

    sigh Where do I begin? I know I'm not the first to post, but I do not see an answer yet. I configured my iPhone last night and have Cox as my ISP. I also have WiFi at my house. Ultimately, I cannot get email to function properly on the iPhone - mostl