Results 1 to 5 of 5

Thread: Flash/EXternal Source question

  1. #1
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default Flash/EXternal Source question

    I only have Flash on trial *27 days*... and i wanna make a flash website... but the content on the News page is gonna be changing...
    I wanna know if i can have it so that it reads the external source *xml,txt,html, just not server side script* and then change the font and format to fit into the content box i will make...
    Tutorials are helpful *esspecially video ones*...

    Thanks to anyone that helps

  2. #2
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Code:
    this.createTextField("my_txt", 10, 10, 10, 320, 100);
    my_txt.autoSize = "left";
    my_txt.border = true;
    my_txt.multiline = true;
    my_txt.wordWrap = true;
    
    var reviews_xml:XML = new XML();
    reviews_xml.ignoreWhite = true;
    reviews_xml.onLoad = function (success:Boolean):Void {
        if (success) {
            var childItems:Array = reviews_xml.firstChild.childNodes;
            for (var i:Number = 0; i < childItems.length; i++) {
                my_txt.text += childItems[i].firstChild.firstChild.nodeValue + "\n";
            }
        } else {
            my_txt.text = "There is either no content to load, or we are about to load content in...";
        }
    }
    reviews_xml.load("text.xml");
    ok this is the actionscript code i have right now in there... but i don't want it to create a text box, i want it to use an assigned textbox called "Content"

    Actionscript 2.0 is what i am using...
    THANKS!

  3. #3
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Btw! I still am looking for an answer!!!! Post if your going to help or researching or just trying to remember... something... please, i only have 25 days left of flash

  4. #4
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    May I ask why you're preferring an assigned text box instead of this script creating a new one?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  5. #5
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    If you already have a text field on the stage which you want to populate with xml data, simply declare the content of that text field to the xml variable reading it.

    For example, take a simple flash page, nothing but one text field (sized to your needs, with fonts embedded if needed, color, size chosen etc.., You can do this via AS...and even XML if you really wanted). Text field has instance name of ContentText.

    XML:
    Code:
    <xml>
        <text>
              <content>Content is here</content>
        </text>
    <xml>
    AS 2.0
    Code:
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    
    xml.onLoad = function(success) {
      if (success) {
             parent = this.firstChild      
             loadContent
    {
    else {
     trace("error loading xml")
    }
    
    xml.load(text.xml)
    
    function loadContent () {
      var ContentTxt = parent.childNodes[0].childNodes[0]
      ContentText.text = ContentTxt
    }

Bookmarks

Posting Permissions

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