08-18-2005, 06:45 PM
|
#1
|
|
Don
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
|
scrolllPane loading images issue?
I have a question on how to do something. First I on my stage I have a scrollPane that I want to use for displaying thumbnail images. So in the library I have a movieClip with a Loader component, an instance name of "myLoader".
Now I have been successful in getting the movieClip into the scrollPane and loading an image, but I want to run through a for loop to load all the images.
How would I go about do this.
ActionScript Code:
var myScrollPane:mx.containers.ScrollPane;
myScrollPane.contentPath = 'mc_container';
//
MyPicVars = new LoadVars();
MyPicVars.load("jetPlane.txt");
MyPicVars.onLoad = function(success) {
if (success) {
trace("loaded");
Rc = this["Rc"];
for (i=0; i<=Rc-1; i++) {
trace(this["pic"+i]);
myScrollPane.content.myLoader.contentPath = "jetPlane/"+this["pic"+i];
}
} else {
trace("not loaded");
}
};
__________________
Damn the torpedoes! Full speed ahead.
|
|
|
08-18-2005, 08:17 PM
|
#2
|
|
Don
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
|
I added a new emptyMovieClip as the myScrollPane.contentPath The trace(mc_container.myLoader.contentPath), list out the correct images in the output box, but I still can't get the images to load.
ActionScript Code:
var myScrollPane:mx.containers.ScrollPane;
myScrollPane.contentPath = 'mc_holder';
//
MyPicVars = new LoadVars();
MyPicVars.load("jetPlane.txt");
MyPicVars.onLoad = function(success) {
if (success) {
trace("loaded");
Rc = this["Rc"];
var my_mc:MovieClip;
for (i=0; i<=Rc-1; i++) {
//trace(this["pic"+i]);
my_mc = myScrollPane.content.attachMovie("mc_container", "mc"+i, i, this.getNextHighestDepth());
my_mc._x = 5;
my_mc._y = 5+(i*80);
mc_container.myLoader.contentPath = "jetPlane/"+this["pic"+i];
trace(mc_container.myLoader.contentPath)
my_mc.i = i;
myScrollPane.invalidate();
}
} else {
trace("not loaded");
}
};
__________________
Damn the torpedoes! Full speed ahead.
|
|
|
08-18-2005, 08:19 PM
|
#3
|
|
I like pizza!
Join Date: Feb 2003
Location: PA
Posts: 1,310
|
EDIT: I wrote this in response to the first post, did not read second yet
Well in each iteration of the loop you are just replacing what you did in the previous iteration. Maybe do this instead....
ActionScript Code:
var myScrollPane:mx.containers.ScrollPane;
// myScrollPane.contentPath = 'mc_container';
// instead make this a blank mc (so have a blank mc in lib with linkage "blank")
myScrollPane.contentPath = "blank";
//
MyPicVars = new LoadVars();
MyPicVars.load("jetPlane.txt");
MyPicVars.onLoad = function(success) {
if (success) {
trace("loaded");
Rc = this["Rc"];
var currentClip;
for (i=0; i<=Rc-1; i++) {
trace(this["pic"+i]);
currentClip = myScrollPane.content.attachMovie("'mc_container'", "pic"+i, i);
currentClip.myLoader.contentPath = "jetPlane/"+this["pic"+i];
}
} else {
trace("not loaded");
}
};
Also, I'm pretty sure I have mentioned before that I have code that does exactly what you are describing here...
http://www.layer51.com/proto/d.aspx?f=1396
|
|
|
08-18-2005, 08:28 PM
|
#4
|
|
Don
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
|
I have seen what you have on your link, but doesn't what you have use XML?
__________________
Damn the torpedoes! Full speed ahead.
|
|
|
08-18-2005, 08:32 PM
|
#5
|
|
I like pizza!
Join Date: Feb 2003
Location: PA
Posts: 1,310
|
It does, but it would be simple for you to create an xml object inside of flash based on whatever you are currently using.
|
|
|
08-18-2005, 08:35 PM
|
#6
|
|
Don
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
|
Will XML run from a cd rom?
__________________
Damn the torpedoes! Full speed ahead.
|
|
|
08-18-2005, 08:36 PM
|
#7
|
|
I like pizza!
Join Date: Feb 2003
Location: PA
Posts: 1,310
|
my_mc = myScrollPane.content.attachMovie("mc_container", "mc"+i, i, this.getNextHighestDepth());
this should probably be ...
my_mc = myScrollPane.content.attachMovie("mc_container", "mc"+i, i);
|
|
|
08-18-2005, 08:37 PM
|
#8
|
|
I like pizza!
Join Date: Feb 2003
Location: PA
Posts: 1,310
|
The xml doesn't have to exist anywhere accept inside the flash movie itself. but certainly you could put an xml file on the cd rom just the same as you would any other text file.
You could create the xml object in flash based on your loaded variables or whatever you want.
|
|
|
08-18-2005, 08:56 PM
|
#9
|
|
Don
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
|
O, I'll have to read up on it and see how to do it.
__________________
Damn the torpedoes! Full speed ahead.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 12:46 AM.
///
|
|