Skip to main content
July 27, 2010
Answered

Php,xml and Flash [multiple holders]

  • July 27, 2010
  • 1 reply
  • 2940 views

Hi

A few days ago I posted a discussion related to php,xml and Flash. I want to display my xml in flash. I got help in doing so. I now have a problem getting  the xml data that is contained in my array to be displayed on different holder movie clips.

This is my code. I have been trying different configuration of the code but with no luck.

var urls:Array = [];

var index:Number;
var index1:Number;

var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = parseXML;
xml.load("content.php");

function parseXML(){
    for(var i:Number=0;i<this.firstChild.childNodes.length;i++){
        urls.push(this.firstChild.childNodes.firstChild.nodeValue);
    }

index=0;
index1=1;

    startyourappF();

}

function startyourappF(){

this.onEnterFrame = preloadA;

holder.loadMovie(urls[index]);

//this is me trying to get the second item in the  url in a another movie clip holder.

holder1.loadMovie(urls[index1]);
}

function preloadA(){

if(holder.getBytesLoaded()>50&&holder.getBytesLoaded()>=holder.getByte sTotal()){

delete this.onEnterFrame;

holder._width = 260.0;

holder._height = 96.0;
}

//this should be resizing for the second holder.
if(holder1.getBytesLoaded()>50&&holder1.getBytesLoaded()>=holder1.getB ytesTotal()){

delete this.onEnterFrame;

holder1._width = 260.0;

holder1._height = 96.0;
}
}

The code sucessfully loads the first image to holder but is unable to load the second url to holder1 and others I want to add. I spend the whole night trying out different configurations of the code but with no success.

I hope you can help me. All I need is more than one image loaded from the urls array variable into multiple other holder variables.

Hope you can help.

cheers>>

This topic has been closed for replies.
Correct answer kglad

Hi

Could you please specify. What you mean and the problems you have identified. I desperately to finish the project in the coming days.

Cheers>>please specify details.


you need to fix your directory  structure first and you need to use relative urls.  there's no sense  working on anything else because what's working now in your first frame  and, if you fix the code in your 2nd frame, it too will break as soon as  you upload to your server.

so, duplicate the directory setup you plan to use on your server and use relative urls.

if your xml, html and swf are in the same directories and you plan to  keep them in the same directories when you upload to your server, use  load("timol.xml") to load your xml.  likewise remove all path info for  loading anything else.

1 reply

kglad
Community Expert
Community Expert
July 27, 2010

do you want them all to load at the start of your app?


July 28, 2010

Yes if possible.

I have about 10 items in the url array and 10 holder video objects my flash project. My actual project is a slide show. So I would like to load the first item in my url array in holder 1 movie object and second url item in holder 2 movie object. Holder 3,4 is in the second slide and I would like to load the third item from the url array into holder 3 and fourth item in url array in holder 4 and so on.

I do not know if loading the first 2 url array object  to holder 1 and 2 is possible then loading the 3  &  4 to holder 3 and 4 when the second slide is open.

kglad
Community Expert
Community Expert
July 28, 2010

all the holder movieclips have to exist when code executes that uses them.  so, if holder3 and holder4 are on a 2nd slide, does that slide exist when the code you showed executes?