Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member hagen's Avatar
    Join Date
    Aug 2005
    Posts
    408
    Member #
    10882
    Liked
    1 times
    Hi all,

    I wish to load 3 variables into flash each time the swf object is loaded...

    I want to pass them via an XML file.

    Could someone provide a simple code snippet?

    Many many thanks!! :-)
    Hagen Rose: hagen(at)jxwd(dot)co(dot)uk
    JX Web Development, Bournemouth, Dorset...JXWD.co.uk

  2.  

  3. #2
    Senior Member hagen's Avatar
    Join Date
    Aug 2005
    Posts
    408
    Member #
    10882
    Liked
    1 times
    here is how it's done...



    Example XML
    ----------------------------------------------------------------------------

    <?xml version="1.0" encoding="utf-8"?>

    <allGalleries>

    <gallery>
    <galleryName>Christmas</galleryName>
    <galleryInfo>A few images from Christmas!</galleryInfo>
    </gallery>

    <gallery>
    <galleryName>Holidays!</galleryName>
    <galleryInfo>A few images from my holiday to Corfu</galleryInfo>
    </gallery>

    </allGalleries>

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


    Example Flash AS3 annotated
    ----------------------------------------------------------------------------


    var myXML:XML; // State that the variable myXML is XML
    var myLoader:URLLoader = new URLLoader(); // Setup a new loader for the XML

    myLoader.load(new URLRequest("galleries.xml")); // Load the XML with URL

    myLoader.addEventListener(Event.COMPLETE, processXML); // Run the function 'processXML' once the XML has loaded in

    function processXML(e:Event):void { // Function 'processXML' starts...
    myXML = new XML(e.target.data); // Something that does something!

    // EXAMPLES to get the variables

    trace(myXML.gallery[0].galleryName); // Trace the first gallery name
    trace(myXML.gallery[1].galleryInfo); // Trace the second gallery info

    // Or create a dynamic text box, call its Instance name something like 'galleryName1_txt' and populate it using the following:
    // galleryName1_txt.htmlText = "<b>" + myXML.gallery[1].galleryName + "</b>";

    }


    Hagen Rose: hagen(at)jxwd(dot)co(dot)uk
    JX Web Development, Bournemouth, Dorset...JXWD.co.uk


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

actionscript configuration file
,

flash variable extract to xml

Click on a term to search for related topics.
All times are GMT -6. The time now is 08:06 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com