dcsimg
A Flash Developer Resource Site

Page 3 of 4 FirstFirst 1234 LastLast
Results 41 to 60 of 61

Thread: load XML into Flash Component

  1. #41
    Member
    Join Date
    Jun 2000
    Posts
    97
    Just used this on it's own and it seemed to work:

    function loadContent(file){
    my_ta.text = " ";
    _xml = new XML();
    _xml.ignoreWhite = true;
    _xml.load(file);


    Now for the images and the stylesheet, as the stylesheet is not incorporating ... Although it does still look nice, it's not quite there.
    Stagehand

  2. #42
    Member
    Join Date
    Jun 2000
    Posts
    97
    Ok, sorted out the text formatting etc .......... Phew!


    Just the images now .... Same as before ..... Might need your help here buddy if you can spare 5 ;o)

    Just this last thing and I'm done. ......... THANK F*CK
    Stagehand

  3. #43
    Member
    Join Date
    Jun 2000
    Posts
    97
    DONE!!!!!


    Mr Dog, you are a fooking legend my man ......

    Thank you so much for your help on this .... I know I've been a headache, but thanks, I really appreciate it .....

    May the force be with you...... Always!
    Stagehand

  4. #44
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    glad to assist
    good luck

  5. #45
    Member
    Join Date
    Jun 2000
    Posts
    97
    Oh how I don't want to write this next bit

    Please feel free to ignore me also ... I just figured that as you know my project and I've not been able to find anything about it on Flashkit, you might give me a little advice.

    Is there any way to dynamically call a movie clip that will hold buttons which will only be called when there are extra pages from XML?

    Just a forward and back button really to call the extra content or another XML ... That's hidden in an MC, which can be called upon as and when needed ....

    Or if you know of another solution, that would be great. Though if XML can do it that would be spot on ... As then the whole thing will be dynamic.

    Like I say, please feel free to ignore this ..... I nearly ignored it when I gave the guy the solution and he wanted that little bit more .....

    Stagehand

  6. #46
    Member
    Join Date
    Jun 2000
    Posts
    97
    Dog, scratch that ....

    Can I get a line of code that will load a small movie inside a movie clip .... I'm going to just load a small swf into an MC called 'morecon' ... Which will have the buttons in to load seperate XML into the content areas ..

    I've played with the code but just can't seem to get a movie loaded into an mc on the stage from that bloody tree.

    Here's the XML:

    Code:
    <node label="Lesson 7" src="section7.xml" img="DCP_0730.jpg" description="Exteneded Text" morecon="buttonsample.swf" />
    morecon MC on stage ... Just need the tree to call the buttonsample.swf from the XML and load into moreconMC on the stage ...

    Does that make sense?

    Thanks fella
    Last edited by stagehand; 12-04-2007 at 06:00 AM.
    Stagehand

  7. #47
    Member
    Join Date
    Jun 2000
    Posts
    97
    Actually SCRATCH THAT!!!!!

    Got that working a treat ....

    One thing I've not thought of though ...... Reading and placing the XML content of the tree.xml into the holders on the _root movie ....

    They're just keyframes and not button calls .... So it'll be the old onload etc .... It's just the reading of the nodes to go in the specific place I need.

    Basically a keyframe that onload reads the tree.xml and places it in the right places .....

    This is the tough bit me thinks ....
    Stagehand

  8. #48
    Member
    Join Date
    Jun 2000
    Posts
    97
    Dog, Shouldn't this work ...?

    Code:
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData._highquality = 2;
    xmlData.load("5_2_l.xml");
    xmlData.onLoad = function(success)
    {
            if(success)
            {
                    _root.my_ta.text = xmlData;
            }
    }
    
    
    function loadContent(file){ 
    _xml = new XML(); 
    _xml.ignoreWhite = true; 
    _xml.load("5_2extra.xml"); 
    _xml.onLoad = function(){ 
    image = this.firstChild.attributes.img; trace(image); 
    txt = this.firstChild.attributes.txt; trace(txt); 
    _root.my_ldr.load(image); 
    _root.description.text = txt; 
    }; 
    }; 
    
    
    stop();
    I'd have thought that was spot on .... I'm just using a replacement XML for each additional MAIN CONTENT page ... And the other method is basically your code with the _root added to target the main movie .....

    The first part works an an absolute treat ... But the second is killing me ..... I basically have the same kind of thing you saw before, only with an extra textArea (description) ..... my_ta is well and truly covered ....

    Can you please help with my_ldr and description ......?

    Once I can get all the content to load from the buttton clip comfortably, it's done ... Send the flash button fla to the fella and he can change the keyframes as he sees fit ....

    I'll still crack away, but if you spot something ....

    Stagehand

  9. #49
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Code:
    function loadContent(file){ 
    _xml = new XML(); 
    _xml.ignoreWhite = true; 
    _xml.load(file); 
    _xml.onLoad = function(){ 
    image = this.firstChild.attributes.img; trace(image); 
    txt = this.firstChild.attributes.txt; trace(txt); 
    _root.my_ldr.load(image); 
    _root.description.text = txt; 
    }; 
    }; 
    
    
    someButton.onRelease = function(){ // button event
    loadContent("somefile.xml");
    };
    
    //frame action -
    loadContent("5_2extra.xml");
    any closer ??

  10. #50
    Member
    Join Date
    Jun 2000
    Posts
    97
    No, not closer AT ALL ......

    It's absolutely spot on guv'nor ......

    Awesome dog ..... Absolutely fooking awesome!!!!

    Thanks AGAIN!!!!

    Hey, you don't want to be my Flashkit PA do you?
    Stagehand

  11. #51
    Member
    Join Date
    Jun 2000
    Posts
    97
    Oh oh, one slight small thing ... After adding the CDATA to the XML file I'm replacing it with ... Which I forgot to do, I lose the formatting with this code:

    Code:
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData._highquality = 2;
    xmlData.load("5_2_lextra.xml");
    xmlData.onLoad = function(success)
    {
            if(success)
            {
                    _root.my_ta.text = xmlData;
            }
    }
    I did take a look at your original code but there was so much of it and it was related to the tree that I can't seem to figure out which of it to use.



    Oh, on another small note ... Is it possible to have the size of the image or SWF file to adjust it's size to fit the component area when it's dragged from XML?

    he reason I ask is that when I load an image it adjusts itself to the width and centres itself, therefore giving lots of blank space at the top and bottom ....

    Is there any kind of resize option or align the content to top upon load?
    Last edited by stagehand; 12-05-2007 at 06:33 AM.
    Stagehand

  12. #52
    Member
    Join Date
    Jun 2000
    Posts
    97
    Where oh where has my good doggie gone?

    I swear this is the LAST request dog if you can bail me out further.
    Stagehand

  13. #53
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    1 - show how you have used CDATA element
    2 - use the MovieClipLoader class

  14. #54
    Member
    Join Date
    Jun 2000
    Posts
    97
    Here's the code I use which shows up perfect:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <page>
    <![CDATA[<header><p>Orographic Triggers</p></header>
    
    
    <spacer><p> </p></spacer>
    
    <section>
    <li><sectionhead>What are orographic triggers?</sectionhead></li>
    <subsection><p>If the air MASS IS ABSOLUTELY unstable any rising ground will trigger immediate convection, which will continue on up, forming cloud, when the rising air cools to its dew point. If the air is very dry, cloud may never form, but the convection will still be present. Glider pilots call this "blue thermals". If the air is absolutely stable, then no matter how high the mountains, the air will sink back down on the lee side, and there will be no convection.<br />
    </p>
    </subsection>
    </section>
    
    
    <section>
    
    <sectionhead><p><li>How do orographic triggers effect conditionally unstable air?</li></p></sectionhead>
    
    
    <subsection><p>The illustration shows the condition of rising air against an ELR of about 2 degrees C/1000ft.If the air was forced to rise and keep on rising it would cool first at the DALR until it reaches its dew point, and then cloud would begin to form If it is forced to rise further it cools at the SALR. It is not yet unstable<br /></p></subsection>
    
    </section>]]>
    
    </page>

    MovieClipLoader class? Ok, thanks, I'll check that out.
    Stagehand

  15. #55
    Member
    Join Date
    Jun 2000
    Posts
    97
    Blimey, MovieClipLoader is gonna be a headache isn't it .... Few posts in XML and not that many on google with an align feature.

    Looks like it's the manual resize option for me, lol.
    Stagehand

  16. #56
    Member
    Join Date
    Jun 2000
    Posts
    97
    You still there dog?

    I'm struggling here
    Stagehand

  17. #57
    Member
    Join Date
    Jun 2000
    Posts
    97
    Dog?????????
    Stagehand

  18. #58
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    sorry.. thought this thread was resolved

    if this is a new problem, suggest you start a new thread
    Last edited by a_modified_dog; 12-17-2007 at 08:19 AM.

  19. #59
    Member
    Join Date
    Jun 2000
    Posts
    97
    No mate, same problem .... Regarding the formatting when loading from the button MC which has been loaded via the XML ..

    The other problem which you said use the MovieClipLoader .. I'm having major problems locating anything either on this forum or the next .... I only want to align the image to Top/Left.
    Stagehand

  20. #60
    Member
    Join Date
    Jun 2000
    Posts
    97
    ????
    Stagehand

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center