The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 6 of 6

Thread: [AS3] XML class problems

  1. #1

    [AS3] XML class problems

    Hi All

    Im working on my first AS3 class, but are stocked with a problem.
    My idea is to make a xml class, where i gave the url for the xml doc in the flash files.

    my class right now look like:
    Code:
    package classes {
     public class xmlClass {
     
      public var xmlMenu:XML;
      public var xmlContent:XML;
      public var url:String;
     
      public function xmlClass(url:String=""){
                var xmlLoader:URLLoader = new URLLoader();
       xmlLoader.addEventListener(Event.COMPLETE, showXML);
       xmlLoader.load(new URLRequest(url));
            }
      public function showXML(e:Event):void {
       trace("XML Loaded");
       XML.ignoreWhitespace = true;
       var xmlMenu:XML = new XML(event.target.data);
       var xmlContent:XML = new XML(event.target.data);  
      }
     
     }
    }
    And my flash look like
    Code:
    import classes.xmlClass;
    var xml:xmlClass = new xmlClass("xml/main.xml");
    But i cant get it to work :S

    i get the output:
    1046: Type was not found or was not a compile-time constant: Event.

    I really hope somebody can help!
    cheers!

    /rosenberg

  2. #2
    did you try importing the events classes?

    Code:
    import flash.events.*;

  3. #3
    Hi, pear!

    no i havent. and it handle my first output.

    But it still dosnt work.

    My class is made right ?

    /cheers

  4. #4
    OMG dude.

    i forgot the
    import flash.net.URLRequest;

    sry. thank you for open my eyes!

  5. #5

  6. #6
    You dont need to put ingnorewhitespace anymore I believe. Also you don't need to redeclare a variable if you already did it at the top of the class.

    Check out my XML Loader Class

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012