I’ve been trying to resolve this for a while now…
[COLOR=DarkRed]Images I am loading from XML are associated with the right record on first load but then on refresh they swap places !!! WHY!? :-/[/COLOR]
I am loading XML and creating arrays.
Then I pass the array data to objects using loop functions.
the AS counts how many books there are in total then and creates the objects and passes informations regarding each book into the individual objects.
when I trace the array data just before starting the loop function I get a good consistent read:
>
[COLOR=DarkOrange]Images:[/COLOR]images/Gordon_Ramsays_Sunday_Lunch.jpg,images/Easy_Italian.jpg,images/Healthy_Foods.jpg
[COLOR=DarkOrange]Text: [/COLOR]Gordon Ramsay’s Sunday Lunch,Easy Italian,Healthy Food
[COLOR=DarkOrange]Links:[/COLOR] Gordon Ramsay’s Sunday Lunch link,Easy Italian link,Healthy Food link
[COLOR=DarkOrange]Prices:[/COLOR] £19.99 hardback,£8.99 paperback,£8.99 paperback output
>
so the XML loading is not the problem.
Is it something to do with the way I am using ‘loadClip();’
This is the code building the page:
//---------------------------------------------------------
/*
- This frame we will build the navigation
/
stop();
//
trace("Images: "+astrImages);
trace("Text: "+astrText);
trace("Links: "+astrLinks);
trace("Prices: "+astrPrice);
//
for (var i = 0; i<nTotalButtons; i++) {
navHolder_mc.createEmptyMovieClip(“navButton”+i,i);
// make new MovieClip and set to newly created button
var navButton:MovieClip = navHolder_mc[“navButton”+i];
// load images
image_mcl.loadClip(astrImages,navButton);
}
// Invoked when the actions on the first frame of the loaded clip have been executed
mclListener.onLoadInit = function(target_mc:MovieClip) {
// add link property
target_mc.linkURL = astrLinks[nCounter];
// add events
target_mc.onPress = buttonClick;
//
var bookImgHeight:Number = target_mc._height;
var bookImgWidth:Number = target_mc._width;
//reposition the new istance of the book object
target_mc._y = Math.round(yPosition);
yPosition += bookImgHeight+10;
//
//–title text–
// place the text
target_mc.createTextField(“titleText”,nCounter,130,0,400,30);
// set properties of title text
target_mc.titleText.border = false;
target_mc.titleText.selectable = false;
target_mc.titleText.wordWrap = true;
target_mc.titleText.styleSheet = my_css;
target_mc.titleText.htmlText = “<.buttonStyle>”+astrText[nCounter]+"</.buttonStyle>";
// reposition the price text
target_mc.titleText.autoSize = true;
var nMiddle:Number = (bookImgHeight/2);
target_mc.titleText._y = nMiddle-(target_mc.titleText._height/2+60);
//
//
//–price text–
// place the text
target_mc.createTextField(“priceText”,nCounter+1,130,0,200,30);
// set properties of price text
target_mc.priceText.border = false;
target_mc.priceText.selectable = false;
target_mc.priceText.wordWrap = true;
target_mc.priceText.styleSheet = my_css;
target_mc.priceText.htmlText = “<.priceStyle>”+astrPrice[nCounter]+"</.priceStyle>";
// reposition the price text
target_mc.priceText.autoSize = true;
var nMiddle:Number = (bookImgHeight/2);
target_mc.priceText._y = nMiddle-(target_mc.priceText._height/2+30);
//
//
nCounter += 1;
};
image_mcl.addListener(mclListener);
//---------------------------------------------------------
this the simple XML code:
http://www.thecliffsoncape.com/xml_test_site1/navigation.xml
this the test site:
http://www.thecliffsoncape.com/xml_test_site1/navigation_Flash8.html
load once, notice the position of the book covers.
load again, it al goes swappy !!
**HELP PLEASE!
**thank you.