ActionScript 3 - XML - NavigateToURL

Ok there are many tutorials out there on how to use this function, what I am trying to do and can't seem to find a tutorial on is using navigateToURL with the "mailto" email address being populated from an XML list.
For example you have a list of offices and each office has a lead. I want to populate a List component with the office name, and when clicked I want it to open the email client and populate the To: and Subject line from the xml file.
What I have so far populates the Office name into the list and when clicked  the mail client will open but doesnt populate the To because I can't figure it out.
I believe I need to specify a var to pull the email address from the xml list, I just cant seem to get it right.
here is a snippet example of my xml code
<officeleads>
  <office>
   <officenm>PDX</officenm>
   <emllink>[email protected]</emllink>   <-------- I want this to populate the "To:" in an email
  </office>
</officeleads>
and here is my ActionScript
var leadloader:URLLoader = new URLLoader();
leadloader.addEventListener(Event.COMPLETE, onLoaded);
leadlist.addEventListener(Event.CHANGE, openMailClient);
function openMailClient(l:Event):void
var request:URLRequest = new URLRequest();
request.url="mailto:"                 <----------  this is where I know I need to somehow specify the emllink in the xml file to be filled into the "To:"
navigateToURL(request,"Self");
var xml:XML;
function onLoaded (l:Event):void
  xml = new XML(l.target.data);
  var offlst:XMLList = xml.office;
  for (var i:uint=0; i<offlst.length();i++)
   leadlist.addItem({data:offlst.officenm.text()[i],
       label:offlst.officenm.text()[i]});
leadloader.load(new URLRequest("officeleads.xml"));
Any help will be greatly appreciated.
Thanks
Sam
AS3 Noob

try:
import fl.events.ListEvent;
var leadloader:URLLoader = new URLLoader();
leadloader.addEventListener(Event.COMPLETE, onLoaded);
leadlist.addEventListener(ListEvent.ITEM_CLICK, openMailClient);
function openMailClient(e:ListEvent):void {
   var request:URLRequest=new URLRequest("mailto:"+leadlist.getItemAt(int(e.rowIndex)).data);
    navigateToURL(request,"_self");
var xml:XML;
function onLoaded(l:Event):void {
    xml = new XML(l.target.data);
    var offlst:XMLList = xml.office;
    for (var i:uint=0; i<offlst.length(); i++) {
       leadlist.addItem({data:offlst.emllink.text()[i],
               label:offlst.officenm.text()[i]});
leadloader.load(new URLRequest("officeleads.xml"));

Similar Messages

  • Can I add a HTML code in adobe flash CS5 ?

    Hello ! I'm French
    I'm working in a flash template (like this one http://www.templatemonster.com/flash-templates/22075.html) and I would like add a HTML code. Could I ?
    If I can, where insert him ?
    Thank-you, have a good day, Jérôme.

    if your textfield has instance name tf, you can use:
    if actionscript 2:
    getURL ("mailto:[email protected]?subject=Flash Form&body="+tf.text);
    if actionscript 3:
    navigateToURL(new URLRequest("mailto:[email protected]?subject=Flash Form&body="+tf.text));

  • File attachments for multimedia (specifically flash)

    I am trying to provide flash content in a pdf document. The flash file itself is programmed dynamically, so that it gets its data from an xml file. It uses the ActionScript XML class to load the xml file.
    I need to attach the xml file and the flash filr within the PDF. I am able to embed both the files, but the flash file is not able to access the xml file. Any suggestions on attaching the xml such that it simulates being on an actual filesystem for the flash?

    It looks like, there is no way for flash swf file to get data dynamically (e.g. as xml) in PDF.
    PDF does not have a facility to set parameters for the application like html provides (c.f. PARAM NAME=FlashVars VALUE="name1=value1" in object tag).
    If we try to use javascript, there is no way to get a javascript variable for the flash movie embedded in pdf. Therefore, we can not do something like this:
    var flashMovie=getFlashMovieObject("flashMovie1");
    flashMovie.SetVariable("name1",
    "value1");
    Does anybody know a way to set flash specific parameters when running flash movie embedded in pdf?

  • Flash Image Gallery load problem

    This a familiar problem that has been put up here a thousand
    times I'm sure but as yet I haven't been able to find a solution
    for it. I've put together a simple image gallery using Flash and an
    XML file. It works perfectly on my system but there are issues with
    the images loading properly when I put them onto my site. I know
    very little Flash, I've been using a pre-made gallery that I
    downloaded but since it works on my computer I assume I should be
    able to get it to work online too. The thumbnails for the file seem
    to work fine and the information from the XML file is obviously
    being accessed, however the main images are not loading. I've
    included all the code below (Actionscript, XML and the Web coding),
    if someone could help me before I put my fist through a wall that
    would be great:
    Actionscript
    stop();
    //specify the url where folder is located below (if
    applicable)
    toadd="";
    t = 0;
    l = 0;
    theside = 1;
    galxml = new XML();
    galxml.load(toadd+"flash/fashion/easy-xml-gallery-2.xml");
    galxml.ignoreWhite = true;
    galxml.onLoad = function(success) {
    if (success) {
    maxnum = galxml.firstChild.childNodes.length;
    for (n=0; n<maxnum; n++) {
    specs = galxml.firstChild.childNodes[n];
    //TEXT FOR SIDE NAV
    duplicateMovieClip(side.thumbs.thumbsb, "thumbs"+n, n);
    thumbclip = eval("side.thumbs.thumbs"+n);
    thumbclip._x = n*100;
    thumbclip.thetitle = specs.attributes.name;
    thumbclip.theurl = specs.attributes.theurl;
    thumbclip.thecaption = specs.attributes.caption;
    thumbclip.thenum = n+1;
    thumbclip._alpha = 100;
    loadMovie(toadd+"/flash/fashion/images/"+(n+1)+"b.jpg",
    thumbclip.thumbload.thumbload2);
    play();
    side.thumbs.thumbsb._visible = false;
    mainperc.onEnterFrame = function() {
    if (mainperc.perc<98) {
    mainperc._alpha += 5;
    mainperc.perc = Math.round(l/t*100);
    mainperc.perctext = mainperc.perc+"%";
    mainperc.ltext = "OF THUMBNAILS LOADED
    ("+Math.round(t/1024)+"kb)";
    if (mainperc.perc>98) {
    //mainperc._alpha -= 5;
    if (mainperc._alpha<-50) {
    delete mainperc.onEnterFrame;
    XML
    <gallery>
    <pic1 name="ONE">
    <pic2 name="TWO"/>
    <pic3 name="THREE"/>
    <pic4 name="FOUR"/>
    <pic5 name="FIVE"/>
    <pic6 name="SIX"/>
    <pic7 name="SEVEN"/>
    <pic8 name="EIGHT"/>
    <pic9 name="NINE"/>
    <pic10 name="TEN"/>
    </gallery>
    Webpage coding
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>shorty designs</title>
    <style type="text/css">
    <!--
    body,td,th {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #666666;
    body {
    margin-left: 0px;
    margin-top: 0px;
    background-image: url(images/fashion_back.gif);
    background-repeat: no-repeat;
    a:hover {
    color: #999999;
    text-decoration: none;
    .Sections {
    color: #333333;
    font-weight: bold;
    #wrapper {
    background-color: #FFFFFF;
    padding: 10px;
    width: 760px;
    margin-right: auto;
    margin-left: auto;
    .section_reg {
    color: #333333;
    font-weight: bold;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: large;
    padding-left: 10px;
    .contact {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: large;
    color: #333333;
    background-color: #FFFFFF;
    width: 400px;
    padding-left: 22px;
    text-align: right;
    .section_back {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: large;
    color: #FFFFFF;
    background-color: #000000;
    width: 135px;
    padding-left: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
    background-position: center center;
    vertical-align: middle;
    height: auto;
    .style2 {color: #F0F0F0}
    a:link {
    text-decoration: none;
    color: #333333;
    a:visited {
    text-decoration: none;
    color: #333333;
    a:active {
    text-decoration: none;
    -->
    </style>
    <script src="Scripts/AC_RunActiveContent.js"
    type="text/javascript"></script>
    </head>
    <body>
    <div id="wrapper">
    <p class="Sections"><img src="images/version5.jpg"
    alt="shorty logo" width="166" height="85" /><span
    class="contact">Contact by email:
    [email protected]</span></p>
    <p class="Sections">
    <script type="text/javascript">
    AC_FL_RunContent( 'codebase','
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','wid th','536','height','518','align','right','src','/flash/fashion/fashion','quality','high',' pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=Shockwa veFlash','movie','/flash/fashion/fashion'
    ); //end AC code
    </script>
    <noscript>
    <object
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"
    width="536" height="518" align="right">
    <param name="movie" value="/flash/fashion/fashion.swf"
    />
    <param name="quality" value="high" />
    <embed src="/flash/fashion/fashion.swf" width="536"
    height="518" align="right" quality="high" pluginspage="
    http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
    type="application/x-shockwave-flash"></embed>
    </object>
    </noscript>
    </p>
    <p class="section_back">Fashion</p>
    <p class="section_reg"><a
    href="travel.html">Travel</a></p>
    <p class="section_reg"><a
    href="wedding.html">Wedding</a></p>
    <p class="section_reg"><a
    href="layout.html">Layout</a></p>
    <p class="section_reg"><a
    href="personal.html">Personal</a></p>
    </div>
    </body>
    </html>

    Yep, these are the directions:
    this is very easy to update. You only need to edit the simple
    xml file and add images to the images folder.
    step 1.
    add as many images as you like at the size 536 x 403
    step 2.
    create thumbnails for the above images at size 100x75
    step 3.
    update the xml file with the name url and caption for each
    image. (to take the url off just click through to the button on the
    main picture and delete the script that says getURL(theurl)
    step 4.
    open flash file and change the 'toadd' variable to the folder
    where the flash file and image folder is located on your site.
    thats it done.
    The frustrating thing now is that the files are finally being
    found but the thumbnail function has decided to mess up.

  • XMLConnector

    Hi,
    datagrid<--dataset<--xmlconnector<-xml file dynamic
    generateb by a script.php
    xmlconnector parameters : direction receive
    actionscript : xml.Conn.URL = "
    http://www... script.php";
    xmlConn.trigger();
    test movie : i can see display of my table
    publish preview html : i can not see my table
    Can someone help me,
    Danielle

    Ah, solved it... my basic approach for side-stepping caching
    (as described above) worked, just had a bug. I was accidentally
    using the same millisecond date for each call, so it wasn't being a
    unique URL. Oops :)

  • OLM SCORM content issue with FLash Player 9 Active X version 9.0.115

    Hi,
    Does any one have issue completing SCORM online content (flash object) via OLM with FLash Player 9 Active X version 9.0.115 using IE? I have same problem also via mozilla.
    I have two computer one with 9.0.45 and one with 9.0.115. I can complete the online course with version 9.0.45 without any issue but the status always incomplete with version 9.0.115. When using 9.0.115 it seem there is not communication between OLM player and the application (nothing showup in the java console).
    I checked Adobe website and this is what they quoted:
    ActionScript 2 getURL() and ActionScript 3 navigateToURL()calls such as getURL("javascript:myFunction();") fail with live web-server content if the HTML and SWF are in separate domains. This issue appears in Internet Explorer versions 6 and 7.

    Dharma,
    I just tried a piece of flash content using 9.0.115 on iLearning and had no issues, and this should be no different than OLM.
    Is the SCORM Adapter set up and in use with debugging turned on? Do you see information in the java console when running the content using the other version of Flash?

  • Does Flex/Flash Builder allow me to do this?

    Hi, I have a scrolling gallery element that I built in Flash and then imported to catalyst as part of my website. (I'm an artist who is self-taught in the realm of web-building and maintain my own site.)  When I add new images, I end up opening my .fxp file in catalyst and then take that flash element back in Flash and add images, and then export the whole thing as a .swf and then update that file for my site.
    Can using flex/flash builder some how stream line my process where I am instead updating data. i.e. adding new images to a database, which then gets pulled in?
    Also I have text fields that require frequent updating, it would be much easier to simply update a document that gets pulled into the final output.
    Mainly I'm confused on the purpose of flex and flash builder, and am just wondering if it is something I should know in a limited way to make things easier.
    Or is there a much easier way to do this all within catalyst without the round-trip to flash? Should this be a "datalist?"
    if you want to see what I'm working with you can visit my site:
    www.timothymcmahon.com
    the gallery component is reached by clicking on either of the two circles on the lower left after entering the main page.
    Thanks, Tim

    Don't use FlashBuilder for making a gallery. Much better to google "Actionscript xml image gallery" there are a ton of solutions out there.

  • Reading an xml file in actionscript using flex3

    plzz tell me how to read an xml file in actionscript using flex3.......

    One possible option to parse an xml-file to a flex XML object:
    public function parseConXML(source:String):void
                    xmlLoader = new URLLoader();
                    xmlLoader.load(new URLRequest(source));
                      // Eventlistener: if URL loaded --> onLoadComplete function
                      xmlLoader.addEventListener(Event.COMPLETE, xmlLoadComplete);
                public function xmlLoadComplete(evt:Event):void{               
                    var xml:XML = new XML();
                     // ignore comments in XML-File
                    XML.ignoreComments = true;  
                       //ignore whitespaces in XML-File
                     XML.ignoreWhitespace = true;
                    // XML-Objekt erstellen
                    xml = new XML(evt.target.data);
                   //AFTERWARDS use your xml as your wish

  • How to read a xml file in ActionScript

    In mxml we can find <mx:Model> to load a xml and using
    it easily. But in ActionScript, there is no such a Class about this
    function(only implemented in mxml), so how to load a xml file in a
    easy way in ActionScript?
    And I tried using HTTPService, but I think that is not the
    best solution because the code do not know when the hander get the
    data in xml then the function return that value.
    So please someone give a easy way as <mx:model> in mxml
    to read the xml file?
    Thank you very much.

    Flex is asynchronous so HTTPService with result event handler
    is the way to go.

  • How to xml file load in actionscript 3.0

    Hi surfers,
    How to xml file load in actionscript 3.0, How to get xml data.
    Thanks in Advance.
    Pls give me ASAP, i'm struggle here.

    Search Google using "AS3 XML tutorial".

  • How to use URL in actionscript  Instead of services-config.xml?

    Hi Alls,
    I would like to set my service's url in actionScript (I don't
    want to use compiler option -services witch need to recompile swf
    if you change service's url).
    I search for a long time on google but I found nothing, and
    adobe documentation isn't very clear.
    Thank for help!!!

    If you are relying on a services-config.xml file, then this
    must be provided
    at compile time because the compiler uses it to generate
    code.
    If you're not using <mx:DataService>, you can actually
    avoid compiling against
    a services-config.xml file. This is because for the other
    services, such
    as <mx:RemoteObject> or <mx:WebService
    useProxy="true"> or <mx:HTTPService
    useProxy="true">, the main thing the compiler does from
    services-config.xml
    is to generate the code to instantiate the set of channels
    that should be
    used to contact a destination in LCDS.
    Well... you can do that programmatically in ActionScript...
    something like
    this:
    import mx.messaging.ChannelSet;
    import mx.messaging.channels.AMFChannel;
    private function channelInit():void
    var channelSet:ChannelSet = new ChannelSet();
    var channel:AMFChannel = new AMFChannel(null, "
    http://{server.name}:{server.port}/mycontext/messagebroker/amf");
    channelSet.addChannel(channel);
    myRemoteObject.channelSet = channelSet;
    Just make sure you call this initialization code before you
    make any service
    requests. If you're proxied WebServices, be sure that you use
    the ActionScript
    API instead of the MXML tag so that you can delay when
    loadWSDL() is called
    because you'll want to setup the channelSet first.
    Regards,
    Pete
    Hello FredFlex,
    > Hi Alls,
    >
    > I would like to set my service's url in actionScript (I
    don't want to
    > use compiler option -services witch need to recompile
    swf if you
    > change service's url).
    >
    > I search for a long time on google but I found nothing,
    and adobe
    > documentation isn't very clear.
    >
    > Thank for help!!!
    >

  • Actionscript 3 XML, Data Providers, and ComboBox

    So i'm trying to use my imported XML, that I turned into an
    XMLList as a DataProvider for a Combo Box.
    Must you turn an XMLList into an array to accomplish this?
    This code traces my list as an array, which seems ready to be
    set as a DataProvider. I've tried setting the DataProvider to the
    Array, to the function that creates the Array and also directly to
    the XMLList, but so far no luck.
    What am i doing wrong?

    try:
    import fl.events.ListEvent;
    var leadloader:URLLoader = new URLLoader();
    leadloader.addEventListener(Event.COMPLETE, onLoaded);
    leadlist.addEventListener(ListEvent.ITEM_CLICK, openMailClient);
    function openMailClient(e:ListEvent):void {
       var request:URLRequest=new URLRequest("mailto:"+leadlist.getItemAt(int(e.rowIndex)).data);
        navigateToURL(request,"_self");
    var xml:XML;
    function onLoaded(l:Event):void {
        xml = new XML(l.target.data);
        var offlst:XMLList = xml.office;
        for (var i:uint=0; i<offlst.length(); i++) {
           leadlist.addItem({data:offlst.emllink.text()[i],
                   label:offlst.officenm.text()[i]});
    leadloader.load(new URLRequest("officeleads.xml"));

  • Services-config.xml with actionscript

    I am amazed there is no half way simple method for creating a RTMP consumer without the need for this services-config.xml file. I have to be able to change, on the fly, what server the Flex client subscribes to and have multiple channels open to multiple servers. Maybe this is beyond the scope or capabilities of the RemoteObject, but we should be able create a consumer, channels, adapters and anything else we need without having to use the services-config.xml file.
    So here is the actual problem, I have everything working with the exception of messages being returned from the server are never received. I can set up the channels and channelsets, the consumer, and can subscribe and get an ack message back saying it is connected, but no messages ever come back. And yes, we have confirmed the service is getting the subscription and is sending data back to the client if we use the services-config.xml methodology and watch server logs.
    In our services-config.xml, I see
    <adapters>
         <adapter-definition id="messagingAdapter" class="FluorineFx.Messaging.Services.Messaging.MessagingAdapter" default="true"/>
    </adapters>
    Is there some way via actionscript to set up these adapters? Even if it means creating custom XML on the fly for the objects to parse thru, which I'm already doing in some places. Where are the adapters definable other than the services-config.xml?
    Thanks.
    Well the apadters have nothing to do with it as I can remove the mention from the xml and doing things via mxml still works and the AS3 stuff still doesn't work.
    Message was edited by: SchmaltzyMann

    Ah I see they've included it in a seperate file:
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="remoting-service"
        class="flex.messaging.services.RemotingService"
        messageTypes="flex.messaging.messages.RemotingMessage">
        <adapters>
            <adapter-definition id="cf-object" class="coldfusion.flash.messaging.ColdFusionAdapter" default="true"/>
            <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter"/>
        </adapters>
        <default-channels>
            <channel ref="my-cfamf"/>
        </default-channels>
        <destination id="ColdFusion">
            <channels>
                <channel ref="my-cfamf"/>
            </channels>
            <properties>
                <source>*</source>
            </properties>
        </destination>
    </service>

  • Connect ActionScript With XML Link

    Hi,
    Please if somebody can help me with this issue.
    I have Flash Movie (with multiple movie symbols) file that parses XML file(gallery.load("gallery.xml") with this
               <image>
                <date>03.31.06</date>
                <title>View of Seattle</title>
                <desc>View of Seattle</desc>
                <thumb>seattle5.jpg</thumb>
                <img>seattle5.jpg</img>
            </image>
            <image>
                <date>03.31.06</date>
                <title>View of New York</title>
                <desc>View of New York</desc>
                <thumb>New York.jpg</thumb>
                <img link="http://www.newyork.com">New York</img>
            </image>
    Action Script places first image in Flash File new movie symbol (new window).
              this.onRelease = function()
              showFullImage(this.imgToLoad, this.imgDesc);
    My problem is:
               i need to connect to image or to http
               depending on the tag in xml.
               In first example <thumb>Seattle5.jpg</thumb> button click will send image to Flash movie new window while
               <thumb>New York.jpg</thumb> click will open http://www.newyork.com
              this.onRelease = function()
              showFullImage(this.imgToLoad, this.imgDesc);
              i need to diferentiate here to let the ActionScript know that there is link present in XML
             getUrl(Link, "_blank");
    How can i make this split in Actionscript.
    Thank you

    I am not an xml expert in the least, but if I were faced with what you want to do I would probably have two separate fields in each image set for those two things... <img>  and <link>  and I would be checking if the img tage was assigned a null value or not when making the decision how to code each one...
    if(<img> is not null) code to show the large image
    Just to mention, the code you are showing is AS2, not AS3, so you may want to move your inquiries to the AS2 forum if you aren't planning to use AS3.

  • Edit XML node using actionscript?

    How would I go about editing an XML node from within
    actionscript?
    I load the XML from a file, and before I pass it to an
    HTTPService I would like to set the field DateTime. The XML file
    that I am using can be seen here:
    XML Document
    When I try doing something like
    myXML.fiAPI.fiHeader.Service.DateTime="time here", it creates a new
    fiAPI node with all new children. However, I wish to edit the
    current DateTime field without creating a new one.
    All help is appreciated.

    Thanks to both of you.
    ctzn99: I tried that as well, after realizing my mistake.
    However, it still does not work. I'm certain I have the path right,
    but nothing is set (or in other cases, returned). Even when I use
    myXML.fiHeader..., It creates a new fiHeader node and the
    corresponding nodes underneath it.
    ntsiii: That's a very complex example, like you said...
    almost overkill for my problem?
    Thanks though!

Maybe you are looking for