Greetings,
I have a few problems I have been trying to hammer out with little success and was hoping someone could help out.
I am coding a php/flash image gallery and have hit several roadbloacks. Currently I have a php file which is called from my flash gallery which supplies all the names of all the files in the directory. All the names are passed into an array working fine.
I then generate movieClips for each thumbnail image and display it one continuous series. There are also two buttons which control panning of the thumbnails, left to right.
All work is done in Flash MX.
Problem #1:
The buttons exist in (Layer 2) and have separte actionscpipt from each. I am having problems accessing a needed variable from the main actionscprit in Layer 2. I have tried many differnt ways to get this variable over but this is what I currently have:
Right Button actionscript present in Layer 2:
on(rollOver){ mOver = true; } // Mouse over button
on(press){ mPress = true; } // Button and pressed
on(rollOut){ mOver = false; } // Mouse off of button
on(release){ mPress = false; } // Button released
onClipEvent ( enterFrame ) {
num = _root.numImages; // Get number of images from root
// If over and last image still not in full view, move images slowly
if (mOver & _root[“imageHolder”+num]._x >= 700) {
for(i=0;i<num;i++){
_root[“imageHolder”+i]._x-=5; // Move all images left 5 pixels
}
}
// If press and last image still not in full view, move images rapidly
if (mPress & _root[“imageHolder”+num]._x >= 700) {
for(i=0;i<num;i++){
_root[“imageHolder”+i]._x-=50; // Movel all images left 50 pixels
}
}
}
Actionscript from main which loads array defines numImages
var imageList = new Array();
var imagesLV = new LoadVars();
var numImages;
imagesLV.onLoad = function(success) {
if (success) {
imageList = this.images.split(","); // Populate Flash array
numImages = imageList.length; // Get length of list
// _root.name.text = numImages; // Display numImages to dynamic text box
…
}
}
imagesLV.load(“getList.php”); // Get image list from PHP
I have also tried calling _root.imagesLV.numImages in the button actionscript with no luck??
Problem #2:
I am wanting to make the thumbnail images buttons that when pressed the image for that movieClip is displayed in larger format. After the movieClip has an image loaded it seems to not accept button actionspripts
Code which generates thumbnail series (THIS WORKS FINE)
for(i=0;i<numImages;i++){
_root.createEmptyMovieClip(“imageHolder”+i, 1000+i);
_root[“imageHolder”+i]._x=i100;
_root[“imageHolder”+i]._y=10;
loadMovie(“thumbs/”+imageList,“imageHolder”+i)
}
// When image5 is rolled over movie it down (This is just to check if it works)
imageHolder5.onRollOver=function(){ // This doesn’t do anything
_root[“imageHolder5”]._y-=100;
}
Last Problem
I want the dynamic text field to update on the rollover of an image. Then text box is contained in Layer 2 and its var parameter is “name”. You can see in the second code clip from Problem 1, I assign the value of the number of images to this field and it works fine. However if do the following it does not update on new actions.
for(i=0;i<3;i++){
_root.createEmptyMovieClip(“button”+i, 100+i);
_root[“button”+i].lineStyle(2, 0x000000, 100);
_root[“button”+i].beginFill(0xFFF000, 100);
_root[“button”+i].moveTo(-10, -10);
_root[“button”+i].lineTo(10, -10);
_root[“button”+i].lineTo(10, 10);
_root[“button”+i].lineTo(-10, 10);
_root[“button”+i].endFill(-10, -10);
_root[“button”+i]._x=i*20;
_root[“button”+i]._y=400;
}
button0.onRollOver = function() { _root.name.text = 0;}
button1.onRollOver = function() { _root.name.text = 1;}
button2.onRollOver = function() { _root.name.text = 2;}
Any ideas as to what is going wrong with this? Thank you in advance for any help as I have been at this for sometime with little luck on these three issues. Let me know if you need the entire .FLA, but I have given most of it above.
Cheer,
Dan