AS 2.0 class  to load and access xml

I am trying to use a Flash actionscript File to load a xml
document and to then be able to use functions with in the class to
access the xml. I tried using a hack found here
http://www.bit-101.com/blog/?p=496
but with no joy. any thoughts ?

Well, it's pseudo code. You need to change your own class to
implement the example. What it boils down to is:
//use the Delegate class
import mx.utils.Delegate;
//assign a function (class member) to the onLoad event of
your xml object
your_xml_object.onLoad=Delegate.create(this,onLoad);
//write a function (in the pseudo code I simply use onLoad
for the name of the function)
private function onLoad(success:Boolean):Void{
if(success){
//do stuff here with the xml data
} else {
trace("Something went wong");
That's it.

Similar Messages

  • How to load and access bitmaps?

    Hey there!
         After a few days of frustration and searching the web, I've finally come to understand how to make a sprite sheet and animate it.  I understand classes and how to import external actionscript files which contain them into my Flash project.  The problem is, I can't figure out how to properly name and load a bitmap file from the folder and pass it onto my functions as arguements.  >_<
    How do I load and access an external bitmap in Actionscript 3.0?
    I'm using a class I found online here:  http://www.bensilvis.com/?p=229
    The problem comes around when I try to access pieces of my bitmap, as he attempts to do here:  http://www.bensilvis.com/?p=317
    var currentSprite:SpriteSheet = new SpriteSheet(sheet, 20, 20);
    This is the only line that is confusing me, becuase he uses a variable "sheet", which is a bitmap, and I'm not sure how to define/name my external bitmap image as such.
    SpriteSheet(tileSheetBitmap:Bitmap, width:Number = 16, height:Number = 16)
    tileSheetBitmap: the Bitmap of the sprite sheet we will use
    width: the width of  tiles in the sheet
    height: the height of tiles in the sheet
    Thank you!  <3

    Actually, nevermind.  I got rid of the "new" and it worked fine.  My bitmap was converted and displalys fine.    Thank you very much!
    However, I keep getting one last error:
      "Call to a possibly undefined methond DrawTile through a reference with a static type SpriteSheet."
    ...I'm not sure what I'm doing wrong.  Here's the DrawTile part of the class:
    public function drawTile(tileNumber:int):BitmapData
                tileRectangle.x = int((tileNumber % rowLength)) * tileWidth;
                tileRectangle.y = int((tileNumber / rowLength)) * tileHeight;
                canvasBitmapData.copyPixels(tileSheetBitmapData, tileRectangle, tilePoint);
                return canvasBitmapData.clone();
    ...and here's my trouble code:
      var sprites:Bitmap = Bitmap(my_loader.content);
                         var MySheet:SpriteSheet = new SpriteSheet(sprites, 32, 32);
                        sprites.bitmapData = MySheet.DrawTile(0);
                        addChild(sprites);

  • Problem with  whitespace  then loading and saving xml

    i do not know how to handle this problem. i modifed a texteditor to send XML to a server and load XML back to the container.
    but then i do changes to the Textlayout it shows up like this --->
    Text in Container not modifed
    Text in Container modifed ---> with space beween the colorchanged string
    Text inContainersend and loaded ---> i think this has something to to with the
    TextFilter.export(_textFlow,TextFilter.TEXT_LAYOUT_FORMAT,ConversionType.XML_TYPE)
    can someone give me a hint...

    Hi,
    the link is --->
    http://www.horstmann-architekten.de/contentmanagment/SimpleEditor.html
    its a modified example of the texteditor provided by Adobe. You can send a xml to the server. and also read it from the server. You just use the xml identifer to give the xml a name.
    Try it out:
    1.  change the text and
    2.  give a XML-Identifer
         and then send it to the server. --> send to server
    3.  type in the XML-Identifer you have used and
    4.   load it from the server ---> Load from Server Button
    evering works ok exept the columns formating.
    I Think the colums Formating is not embeded in the XML as it should be. I attached the Files. (Newbie programmer)
    With best regards
    Michael Sprinzl
    --- robin.briggs <[email protected]> schrieb am Do, 17.9.2009:
    Von: robin.briggs <[email protected]>
    Betreff: Problem with  whitespace  then loading and saving xml
    An: "Michael sprinzl" <[email protected]>
    Datum: Donnerstag, 17. September 2009, 2:12
    Sounds like you have two different issues going on: (1) inline graphics aren't coming out correctly when you use the TextLineFactory, and (2) columns aren't working correctly. It's difficult for me to tell by looking at the application you link what is going wrong. One of the examples does seem to have columns working -- can you be more specific about what you're doing, and what results you are seeing? As for the inline graphics, there is a timing issue involved with using URLs, due to the asynchronous loading. See this comment in the docs for TextFlowTextLineFactory:
    Note: When using inline graphics, the source property of the InlineGraphicElement object   must either be an instance of a DisplayObject or a Class object representing an embedded asset.   URLRequest objects cannot be used. The width and height of the inline graphic at the time the line   is created is used to compose the flow.
    - robin

  • Loading and viewing XML when a class object is created..Help Please

    Hello,
    I have writing a simple class which has a method that gets invoke when the object of the class is created. I am able to view the loaded XML content when I trace it with in my class method, but cannot assign the content to a instance variable using the mutator method. So the process goes like this:
    Class object is instantiated
    Class construtor then calls the loadXML method which laods the XML
    And then assigns the XML to a class instance variable.
    So now if I would like to access the loaded XML through class object, I should be able to see the loaded xml content which I am not able to see. I have spent over few hours and cannot get the class object to display the loaded XML content. I would highly appreciate it if someone can help in the right direction, please.
    [code]
    package com.as3.app
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.net.*;
        public class Cars extends MovieClip {
               public var _CarList:Object;
               public function Quiz()
                  super();
                  loadCars();
    // ===========================================================
    //           CARS GETTER SETTER
    // ===========================================================
            public function set Cars(val:XML):void
                this._CarList = val;
            public function get Cars():XML
                return this._CarList;
    // ===========================================================
    //            LOAD QUESTIONS FROM XML
    // ===========================================================
            public function loadcars()
                var myXML:XML;
                var myLoader:URLLoader = new URLLoader();
                myLoader.load(new URLRequest("xml/cars.xml"));
                myLoader.addEventListener(Event.COMPLETE, processXML);
                function processXML(e:Event):void
                    myXML = new XML(e.target.data);  
                    Cars = myXML;                 // Assigning the loaded xml data via mutator method to the _CarList;
    //=============================================================  
                                  INSTANTIATING THE CLASS OBJECT
    //=============================================================
    package com.as3.app
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.net.*;
        import com.as3.app.*;
        public class DocumentClass extends MovieClip {
            public var c:Car;
            public function DocumentClass()
                super();
                c = new Cars();  
                trace(c.Cars);
    [/code

    where you have:
                super();
                c = new Cars();  
                trace(c.Cars);
    c.Cars will not trace as the loaded xml, because it will not have loaded in time. After some time it should presumably have the correct value.
    loading operations in actionscript are asynchronous, so your nested function which is acting as the listener ( function processXML(e:Event):void) only ever executes when the raw xml data has loaded and that is (I believe, not 100% sure) always at least one frame subsequent to the current one.
    In general I would consider it bad practise to use nested functions like that, but I don't think its contributing to your issues here. I think its just a timing issue given how things work in flash....
    Additional observation:
    your Cars constructor calls loadCars() and your loadCars method is defined as:
    public function loadcars()
    I assume its just a typo in the forum that the uppercase is missing in the function name....

  • When class gets loaded and unloaded

    Hi,
    I want to know when class gets loaded in to the memory, is it when the class is called for the first time??. Also how much time the loaded class will stay in the memory. when the class gets unloaded ??
    chetana_vir

    hahaha class gets loaded or class object?Class. Objects don't get loaded.
    @OP: It certainly gets loaded no later than when the class is first referenced in your code. I may permissible to load it earlier. I don't know the details. Look [url http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44459]here or [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19175]here or [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html]here
    Unloading of a class can only happen if there are no more references to the class or to any instances of it, and if it was loaded by a classloader other than the primordial or the system classloader. It will be unloaded when the classloader that loaded it is unloaded. I forget the details of when this happens, but there can't be any references to any classes loaded by that loader (or to any instances of those classes).
    [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#32202]here for unloading info.
    [url http://java.sun.com/developer/JDCTechTips/2003/tt0819.html#2]Unloading and Reloading Classes
    (which came from http://www.google.com/search?q=java+tech+tip+class+loader&sourceid=opera&num=0&ie=utf-8&oe=utf-8)
    &para;

  • Loading and parsing XML files

    I am currently working on an application in which I have a XML file that is 1.5 mb and has 1100 records that I need to load and parse. Loading takes less than a minute, but when I try to parse it with the DOM parser it's taking too much time. I am trying to put it into an array and then display it as if I'm tied to a database. I need a different approach. Does anyone have any experience and insight with the DOM parser? Would the SAX parser be a better way to go, why and how?

    You can use SAX... but SAX is good only if you want to read the data once.
    If you want to use the same data again and again then you might have to parse the file again... which prooves expensive.
    DOM will take too much of memory and CPU time.
    Have you tried using JDOM ? it is a new kind of a XML parsing utility that is quite lightweight and has good api to recurse the JDOM tree also.
    check it out at
    http://www.jdom.org.
    hope this helps.
    regards,
    Abhishek.

  • Loading and unloading xml galleries

    I have a several galleries that I will be loading via several xml files.  Gallery1 will load on start and the other galleries will load through buttons using their instance names (i.e. "gallery3" button will load "gallery3.xml").  Currently I have a function + listener (called "home") to initiate gallery1 on start, a function + listener (called "goSection") to initiate the other galleries via button instance name, and a function that loads the gallery (called "fileLoaded") with the listener located in the "home" and "goSection" functions.  There is a lot more code in the fileLoaded function that controls the thumbnail and full size images functionality that I am excluding because its probably not necessary for my problem.  Im not sure the most efficient way to set this all up so I unload the existing gallery before I load a new gallery.  Ive tried to use removeChild and removeEventListener on urlLoader without much success.  Any suggestions?  ...
    //BUTTONS
    var sButtons:Array = [gallery1,gallery2,gallery3,gallery4];
    function sButtonsListeners():void {
         for (var i:uint = 0; i < sButtons.length; i++) {
         sButtons[i].addEventListener(MouseEvent.CLICK, goSection);
    sButtonsListeners();
    var urlLoader:URLLoader = new URLLoader();
    //INIT HOME
    function home():void {
         trace("gallery1 loaded");
         //load external xml
         var urlRequest:URLRequest = new URLRequest("gallery1.xml");
         urlLoader.load(urlRequest);
         urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
    home();
    //GO SECTION
    function goSection(event:Event):void {
         trace(instanceName + " loaded");
         var instanceName:String = event.currentTarget.name;
         //load external xml
         var urlRequest:URLRequest = new URLRequest(instanceName + ".xml");
         urlLoader.load(urlRequest);
         urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
    function fileLoaded(event:Event):void {
         var myXML:XML = new XML();
         var xmlList:XMLList;
         myXML.ignoreWhitespace = true;
         var arrayURL:Array = new Array();     //thumbnails
         var arrayName:Array = new Array();     //large photos
         var holderArray:Array = new Array();     //thumbnail holder
         var thumb:Thumbnail;     //represents Thumbnail.AS
         //represents the gallery container
         var sprite:Sprite = new Sprite();
         addChild(sprite);
         //thumbnail container
         var thumbsHolder:Sprite = new Sprite();
         sprite.addChild(thumbsHolder);
         //image container
         var imageHolder:Sprite = new Sprite();
         sprite.addChild(imageHolder);
         //load image
         var imageLoader:UILoader = new UILoader();
         imageLoader.buttonMode = true;
         imageHolder.addChild(imageLoader);
         myXML = XML(event.target.data);
         xmlList = myXML.children();
         for (var i:int=0; i<xmlList.length(); i++) {
         var picURL:String = xmlList[i].url;
         var picName:String = xmlList[i].big_url;
         arrayURL.push(picURL);
         arrayName.push(picName);
         holderArray[i] = new Thumbnail(arrayURL[i],i,arrayName[i]);
         holderArray[i].name = arrayName[i];
         holderArray[i].buttonMode = true;
         holderArray[i].y = 25;
         holderArray[i].x = i * 87 + 142;
         thumbsHolder.addChild(holderArray[i]);

    Anyone?  My biggest concern is unloading the existing gallery before I load a new one.  Currently they load on top of each other.

  • Loading and parsing XML

    what is the best method for loading external XML (with
    inherent HTML) content into Flash and into the TextArea component?
    here is the requirement:
    i have an image loader and a TextArea together on the screen.
    a "story" is loaded which will present a series of images (in the
    image loading) associated with a corresponding text (in the
    TextArea). a "story" has multiple image/text sections that are
    navigatied through with FRWD/BACK buttons. any given section can
    also have multiple sub-sections or "frames".
    here is a diagram of the flow (in this case there would be 5
    click throughs: 5 text/image sequences, but all contained only
    within 4 sections):
    http://jalaka.com/lab/ia/story_nav.jpg
    below is my proposed sample XML structure. i want Flash to
    recognize how many sections and frames within sections there are in
    each story XML document - in order to generate a corresponding
    navigation structure (a tab for each section). HTML content will be
    immediate availble to loadinto TextArea as user move forward in
    sequence with nav. and images references can also be preloaded into
    available MC containers to be swapped into place as user navigates
    forward in sequence. also need to read and store attributes for
    each node in the XML to come up in MCs in sequence. and must also
    be able to parse XML in a way to place simple HTML formatted
    content (within XML) into the TextArea.
    would Arrays be used?
    <story title = "Story Title">
    <section num = "1" title = "Section One Title" >
    <frame image = "1.jpg" caption = "caption text
    here"><b>Content</b><br><br>content
    content content</frame>
    </section>
    <section num = "2" title = "Section Two Title" >
    <frame image = "1.jpg" caption = "caption text
    here"><b>Content</b><br><br>content
    content content</frame>
    <frame image = "2.jpg" caption = "caption text
    here"><b>Content</b><br><br>content
    content content</frame>
    </section>
    </story>

    Placing the XML into an array is a great plan. What you want
    is each array element to be an object containing the section data.
    Another plan is to use a List or Combox component. Again each
    data property element would be an object containing the section
    data.

  • Loading and saving xml in coldfusion

    I'm pretty new to Flex and am trying to save a modified xml
    file to disk using coldfusion. I have figured out how to load the
    xml file into a Flex and modify it with various components, have
    tried to save it back to the server using <cffile>, but the
    file is empty. How do I extract the xml object that is sent back to
    CF from httpservice so I can save the flat xml file again?
    I'm sure the answer is simple but I just haven't found an
    easy tutorial to follow....

    I'm pretty new to Flex and am trying to save a modified xml
    file to disk using coldfusion. I have figured out how to load the
    xml file into a Flex and modify it with various components, have
    tried to save it back to the server using <cffile>, but the
    file is empty. How do I extract the xml object that is sent back to
    CF from httpservice so I can save the flat xml file again?
    I'm sure the answer is simple but I just haven't found an
    easy tutorial to follow....

  • Load and Read XML file size more than 4GB

    Hi All
    My environment is Oracle 10.2.0.4 on Solaris and I have processes to work with XML file as below detail by PL/SQL
    1. I read XML file over HTTP port into XMLTYPE column in table.
    2. I read value no.1 from table and extract to insert into another table
    On test db, everything is work but I got below error when I use production XML file
         ORA-31186: Document contains too many nodes
    Current XML size about 100MB but the procedure must support XML file size more than 4GB in the future.
    Belows are some part of my code for your info.
    1. Read XML by line into variable and insert into table
    LOOP
    UTL_HTTP.read_text(http_resp, v_resptext, 32767);
    DBMS_LOB.writeappend (v_clob, LENGTH(v_resptext), v_resptext);
        END LOOP;
        INSERT INTO XMLTAB VALUES (XMLTYPE(v_clob));
    2. Read cell value from XML column and extract to insert into another table
    DECLARE
    CURSOR c_xml IS
    (SELECT  trim(y.cvalue)
    FROM XMLTAB xt,
    XMLTable('/Table/Rows/Cells/Cell' PASSING xt.XMLDoc
    COLUMNS
    cvalue
    VARCHAR(50)
    PATH '/') y;
        BEGIN
    OPEN c_xml;
    FETCH c_xml INTO v_TempValue;
    <Generate insert statement into another table>
    EXIT WHEN c_xml%NOTFOUND;
    CLOSE c_xml;
        END
    And one more problem is performance issue when XML file is big, first step to load XML content to XMLTYPE column slowly.
    Could you please suggest any solution to read large XML file and improve performance?
    Thank you in advance.
    Hiko      

    See Mark Drake's (Product Manager Oracle XMLDB, Oracle US) response in this old post: ORA-31167: 64k size limit for XML node
    The "in a future release" reference, means that this boundary 64K / node issue, was lifted in 11g and onwards...
    So first of all, if not only due to performance improvements, I would strongly suggest to upgrade to a database version which is supported by Oracle, see My Oracle Support... In short Oracle 10.2.x was in extended support up to summer 2013, if I am not mistaken and is currently not supported anymore...
    If you are able to able to upgrade, please use the much, much more performing XMLType Securefile Binary XML storage option, instead of the XMLType (Basicfile) CLOB storage option.
    HTH

  • Load and Send XML values

    I am new to ActionScript 3 and have a project I would like to get some help on. I have an XML file on a server that has two types of parent nodes... an example is below:
    <bodytypesuggestions>
    <ID1>36</ID1>
    <ID2>34</ID2>
    <ID3>37</ID3>
    </bodytype>
    <bodytypes>
    <ID1>34</ID1>
    <ID2>32</ID2>
    <ID3>35</ID3>
    </bodytype>
    The AS code below connects my flash to the URL:
    import flash.net.*;
    import flash.events.*;
    var myXML:XMLList;
    var url:URLRequest = new URLRequest("MYSERVER.COM");
    var XMLLoader:URLLoader = new URLLoader(url);
    XMLLoader.addEventListener(Event.COMPLETE, GetRecommendations);
    XMLLoader.addEventListener(Event.CHANGE, updateAndGetRecommendations);
    function GetSuggestions(event:Event):void {
    if (XMLLoader.data) {
    myXML = XMLList(XMLLoader.data);
    var myDev:XMLList = new XMLList(XMLLoader.data)
    var bodytypelist:XMLList = myDev..bodytypes
    var bydytypesugglist:XMLList = myDev..bodytypesuggestions
    trace(bodytypelist);
    this["ID1"].text = bodytypelist.ID1;
    this["ID1"].restrict = "0-9.";
    this["ID1"].maxChars = 5;
    this["ID2"].text = bodytypelist.ID2;
    this["ID2"].restrict = "0-9.";
    this["ID2"].maxChars = 5;
    this["ID3"].text = bodytypelist.ID3;
    this["ID3"].restrict = "0-9.";
    this["ID3"].maxChars = 5;
    Now in my flash file, I have 3 textInput fields that are populated with the above XML values from the bodytype child values.
    My question is - how can I write a function that when a user changes a value in any one of the text fields, the data returned is from the bodytypesuggestions node value instantly, i.e. once a field value is changed, the other two will change accordingly. The actual XML on the server already handles those calculations. I hope this makes sense, I really need some help on this one.

    I am not 100% certain what you're asking for here...
    I would tend to send XML rather than an XMLList string. I can't get the e4x filtering to work for an XMLList like that, which means (I assume) that you would need to iterate the list and using filtering on each XML object in the list. Perhaps I've missed something as you don't seem to be expressing a problem with loading the xml data and getting it into the textfields initially. I've not tried using the filtering on an XMLList directly before but could not get it working the way you have it. So in the following simulation I have wrapped the list in a top level tag to get it working the way I wanted.
    Here is a non-loading simulation of what you seem to want. The difference here is that the GetSuggestions 'listener' is called manually with the data string rather than by the URLLoader's listener with the data attached to the URLLoader's dispatched event.
    Hope that helps some.
    var xStr:String="<bodytypesuggestions><ID1>36</ID1><ID2>34</ID2><ID3>37</ID3></bodytypesuggestions><bodytypes><ID1>34</ID1><ID2>32</ID2><ID3>35</ID3></bodytypes>";
    var myXML:XML;
    var suggestions:XMLList;
    //requires 3 input textfields on the stage named ID1, ID2, ID3
    function GetSuggestions(data:String):void {
    if (data) {
    var myXML:XML = XML("<wrapper>"+XMLList(data).toXMLString()+"</wrapper>");
    var bodytypelist:XMLList = myXML..bodytypes;
    suggestions = myXML..bodytypesuggestions;
    ID1.text = bodytypelist.ID1;
    ID1.restrict = "0-9.";
    ID1.maxChars = 5;
    ID2.text = bodytypelist.ID2;
    ID2.restrict = "0-9.";
    ID2.maxChars = 5;
    ID3.text = bodytypelist.ID3;
    ID3.restrict = "0-9.";
    ID3.maxChars = 5;
    GetSuggestions(xStr)
    ID1.addEventListener(Event.CHANGE,myTextListener)
    ID2.addEventListener(Event.CHANGE,myTextListener)
    ID3.addEventListener(Event.CHANGE,myTextListener)
    function myTextListener(e:Event):void{
         var updates:Array = ['ID1','ID2','ID3'];
         //check to see if current value is recognized
         if (TextField(e.currentTarget).text == suggestions.elements(TextField(e.currentTarget).name).text()){
              trace('found match')
              for each(var fieldName:String in updates){
                   if (TextField(e.currentTarget).name==fieldName) continue;
                   TextField(this[fieldName]).text = suggestions.elements(fieldName).text();
                   trace(' set '+fieldName + ' to '+TextField(this[fieldName]).text)

  • How can I load and save text using FileReference class

    Let me start by saying I have no intention of using php and I can't wait until flash cs5 comes out with its new read/write capabilities
    I want to load and save XML files (stored on my local hard-drive) in AS3.
    I am using the FileReference class.
    Firstly I have noticed that when using FileReference.save if you replace an existing file instead of writing over the file data is appended to the end of the file. Can I make it so the file is overwritten (as it should be) or make it impossible for the user to save in such a situation.
    Secondly I want to load in text from an external file using FileReference.load I know that somehow you use FileReference.browse first to get it to work but I want to know exactly how to do it.
    I have looked for a tutorial about loading text in this manner and have not found one.
    Any help would be much appreciated especially if you could point me in the direction of a relevant tutorial
    Thanks

    the filereference class is for downloading and uploading files.
    if you want to load xml, use the xml class.
    and, if you want to write to an xml file and don't want to use server-side code, wait.

  • Problem related to class loader and bootstrap loader

    how class are loaded and how bootstraping please explain it in detail?

    793241 wrote:
    how class are loaded and how bootstraping please explain it in detail?Just to put in different words what previous posters are hinting at; this is not a place to come and get answers when you don't want to do research yourself - it is not even a problem you are having as it has a readily available solution; read and enlighten yourself.

  • Loading XML using a custom class and accessing it from other classes?

    I began with a class for a movie clip rollover function
    FigureRollOver. It works marvellously. Three things happen:
    1) it loads XML from a file "mod1_fig1.xml" and uses another
    class, XMLMember, to retool the scoping of the XML so that I can
    get at it
    2) an onload call inside of XMLMember calls the myOnLoad
    function and transfers the XML into an array.
    3) so long as the array is finished building, rolling over a
    movie clip attaches a new movie clip with the rollover text in it.
    But I don't want all those functions in one because I need it
    to be more dynamic, starting with being able to load any old xml
    file instead of just "mod1_fig1.xml", plus it seems like
    overbuilding to have all of that in one class, so I've separated
    out the loading of the XML and building of the array into its own
    class, FigureXMLLoader. FigureRollOver is then left to just attach
    the rollover with text in it, extracted from the array built by the
    new class.
    Problem is, though the array builds inside FigureXMLLoader, I
    can't figure out how to make it available outside the class. I know
    that I'm constructing things in the wrong order, and that the array
    needs to be somehow built inside the class function to be
    available, but I can't figure out how to do that. A cruddy
    work-around is to put a function call at the end of the building of
    the array, which calls yet ANOTHER function on the main timeline of
    my .swf to put the array I've just built into a new variable. This
    works, but it's messy. It seems like I should be able to have one
    line of script in the .swf that generates an array on the main
    timeline (or just a public array) which I can then access from my
    FigureRollOver class:
    var myRollOvers:Array = new FigureXMLLoader("mod1_fig1.xml");
    Here is FigureXMLLoader (see comments in the code for more
    details) which obviously does not return an array as it is, because
    of all the working around I've had to do. Note the "testing"
    variable, which can be traced from the main timeline of the .swf,
    but I will get "not what I want" because of course the array hasn't
    been built yet, and never will be, inside of the declaration as it
    is. How do I get it in there so I can return an array?
    Thanks!

    Suggest you ask this question in the Actionscript forum as
    this forum is
    more tuned to database integration questions.
    You can create arrays outside a class and pass them into it
    by reference and
    visa versa build arrays inside a class and pass out via
    reference.
    The preferred approach is to place the array in a class and
    not expose it.
    Then add methods to use the array or should we say to use the
    class.
    Lon Hosford
    www.lonhosford.com
    Flash, Actionscript and Flash Media Server examples:
    http://flashexamples.hosfordusa.com
    May many happy bits flow your way!
    "maija_g" <[email protected]> wrote in
    message
    news:ed4i43$9v0$[email protected]..
    > Update: I've now put this on the main timeline of the
    .swf:
    >
    > myRollOversLoaded = false;
    > var myRollOvers:Array;
    > var roll_content = new FigureXMLLoader("mod1_fig1.xml");
    >
    > And inside the "myOnLoad" function in FigureXMLLoader,
    just after the
    > while
    > loop I've put this:
    >
    > _root.myRollOversLoaded = true;
    > _root.myRollOvers = figure_arr;
    >
    > The movie clip rollover won't act until
    myRollOversLoaded is true. It
    > works,
    > but it still seems klugey. Any suggestions for a more
    elegant solution
    > would be
    > appreciated.
    >

  • Load Jar and access a class in jar at run time

    I need help from you.
    How to load a Jar and access a class in the jar at run time?
    When i try the following code it works fine while running in Java (Jdk1.5).If iam running the same code in servlet,ClassCastException occurs.
    Error Message : ClassCastExcption : jartest1 cannot be cast to Thing
    test.jar contains jartest.class and Thing.class
    jartest1.java
    try{
    File file =new File("test.jar");
    String lcStr ="jartest";
    URL jfile = new URL("jar", "", "file:" + file.getAbsolutePath() +"!/");
    URLClassLoader cl = URLClassLoader.newInstance(new URL[] { jfile });
    Class loadedClass = cl.loadClass(lcStr);
    Thing t=(Thing)loadedClass.newInstance();
    t.execute();
    catch(Exception e)
    System.err.println(e);
    Thing.java
    public interface Thing
    void execute();
    jartest.java
    public class jartest implements Thing
    public void exceute()
    System.out.println("Welcome");
    Thanks and Regards
    V.Senthil Kumar
    Edited by: senthilv_sun on Dec 16, 2008 8:30 PM

    senthilv_sun wrote:
    I need help from you.
    How to load a Jar and access a class in the jar at run time?
    When i try the following code it works fine while running in Java (Jdk1.5).If iam running the same code in servlet,ClassCastException occurs.
    Error Message : ClassCastExcption : jartest1 cannot be cast to ThingPresumably we can only hope that that is a transciption error. It always helps to use copy and past actual errors and code rather than manually typing them.
    test.jar contains jartest.class and Thing.classWrong.
    The interface class and plugable class must not be in the same jar.
    A plugable interface requires two components
    - Interface (generic sense)
    - Functional components.
    The Interface must be independant (own jar) so that it is available to the framework (user of plugin) and to the functional components. And the plugable component must not be on the java class path.
    This also means that we know for certain that the plugable component is also on the system class path. That is a bad idea as well.
    Given that it is pretty pointless to even speculate as to why this error is showing up. Create the correct jar layout. Test using the command line. Then test using servlets. Insure that the plugable jar is NOT on the java classpath for both tests.

Maybe you are looking for

  • New effects problem on library loops

    My Logic has been performing close to flawless since I've had it. An update installed today and a new problem has arisen that I can not find a way to fix. Whenever the project tempo is different than the loop tempo, for example, when a drum loop in t

  • Setup PRINT server in Apex 3.0?

    Hi all, I need setup print server on upgraded Apex 3.0 and looking at instructions or manuals thanks in advanced Gordan

  • Vnc-4_1_2-sparc_solaris[1].tar ERROR

    Xvnc Free Edition 4.1.2 - built May 12 2006 17:52:56 Copyright (C) 2002-2005 RealVNC Ltd. See http://www.realvnc.com for information on VNC. Underlying X server release 0, unknown Thu Nov 9 16:26:45 2006 vncext: VNC extension running! vncext: Listeni

  • How to add surcharges to base price

    Dear All , We are Implementing SAP for a service industry. Here in pricing there are so many surcharges are in use. We are maintaining the condition record for gross price. I want the surcharge like fuel charges , for ex , to be added to the gross pr

  • Loop by XSQL/XSL

    Hello. I got a problem in select from DB table. Table format: TYPE BOOKNAME TypeThriller Vbm TypeThriller Dhr TypeThriller Abc TypeThriller Cgf TypeFantastic All TypeFantastic Cdd etc. I need to create XML file like: <Object> <BookObject> <BookType>T