PDA

View Full Version : preLoader component


anime4tw
04-16-2006, 07:55 AM
I want to have preLoaders onto my textArea (that loads an external XML document **which I also have a question about** ) as well as a loader **which i also have a question about**.

The code that I have so far, is as follows:


stop();
//init homeText component
_global.styles.TextArea.setStyle("backgroundColor" , "false");
homeText.html = true;
homeText.wordWrap = true;
homeText.multiline = true;
homeText.label.condenseWhite = true;
//loas css
homeStyle = new TextField.StyleSheet();
homeStyle.load("home.css");
homeText.styleSheet = homeStyle;
//load in XML
homeContent = new XML();
homeContent.ignoreWhite = true;
homeContent.load("home.xml");
homeContent.onLoad = function(success)
{
if(success)
{
homeText.text = homeContent;
}
}

myProgressBarListener2 = new Object();
myProgressBarListener2 = function (eventObject) {
myProgressBar2._visible = false;
};
myProgressBar2.addEventListener("complete", myProgressBarListener2);
myProgressBar2.mode = "polled";
myProgressBar2.source = "homeText";
myProgressBar2.conversion = "1";
myProgressBar2.label = "LOADING 裝貨 %3%%";
myProgressBar2.direction = "right";
myProgressBar2.labelPlacement = "bottom";

myProgressBarListener3 = new Object();
myProgressBarListener3 = function (eventObject) {
myProgressBar3._visible = false;
};
myProgressBar3.addEventListener("complete", myProgressBarListener3);
myProgressBar3.mode = "polled";
myProgressBar3.source = "homePic";
myProgressBar3.conversion = "1";
myProgressBar3.label = "LOADING 裝貨 %3%%";
myProgressBar3.direction = "right";
myProgressBar3.labelPlacement = "bottom";


Now in regards to the textArea (homeText), I would like to use .php scripts inside of it. I already have a GUI (cuteNewsPHP) that allows users to type in their news. I would like to use this to update the Flash File, instead of having to change it directly.
I would also like something similiar with the Loader, which will load a picture from an external file. I would like to have it related to the .xml file. So that, I don't have to change any code, ever. If the .xml file is called "home.xml" and the picture is called "home.jpg" I want it to automatically just load it. So that i will only ever have to change the picture, and not the entire coding to reflect the changes.
I have a dynamic text area right below the picture that I would also like to have display a comment about the picture. I want it to be updated via .xml in accordance with the picture. Again with it being called "home.jpg.xml" or something.
I'm not sure quite how to organize all of this, but if you have any suggestions, I'd love to implement them!!
If you require the .fla, or any more samples, I'd love to help!!

-Bijan