Thanks to the help of some very knowledgeable forum members I was able to successfully get my web project up and running. (www(dot)tatuvalkonenphotography(dot)com)
Now I need to make a slight adjustment to my code (which I will post below).
The photographer has requested that the photographs fade in when clicked rather than just appearing. He says it will give a more polished look to the site.
I know this can be done by tweaking the action script. Please check out the site and note that each image is being loaded in a movie clip when the corresponding button is clicked on the right hand side. The action script is:
Code:
myXML.load("portraits.xml");
myXML.onLoad = function(success){
if(success){
trace(this.getBytesLoaded());
}
}
var ssx:XML = new XML();
ssx.ignoreWhite = true;
var currentIndex:Number = 0;
var captions:Array = new Array();
var urls:Array = new Array();
ssx.onLoad = function(success){
if (success) {
var ss:Array = ssx.firstChild.childNodes;
for (i=0;i<ss.length;i++) {
urls.push("images1/" + ss[i].attributes.url);
}
portraits_mc.loadMovie(urls[currentIndex]);
caption_txt.text = captions[currentIndex];
}
else
{
trace("XML file failed to load. Please try again later.");
}
}
ssx.load("portraits.xml");
function img1() {
portraits_mc.loadMovie(urls[0]);
}
portraits_btn1.onRelease = img1;
function img2() {
portraits_mc.loadMovie(urls[1]);
}
portraits_btn2.onRelease = img2;
function img3() {
portraits_mc.loadMovie(urls[2]);
}
portraits_btn3.onRelease = img3;
function img4() {
portraits_mc.loadMovie(urls[3]);
}
portraits_btn4.onRelease = img4;
function img5() {
portraits_mc.loadMovie(urls[4]);
}
portraits_btn5.onRelease = img5;
function img6() {
portraits_mc.loadMovie(urls[5]);
}
portraits_btn6.onRelease = img6;
function img7() {
portraits_mc.loadMovie(urls[6]);
}
portraits_btn7.onRelease = img7;
function img8() {
portraits_mc.loadMovie(urls[7]);
}
portraits_btn8.onRelease = img8;
function img9() {
portraits_mc.loadMovie(urls[8]);
}
portraits_btn9.onRelease = img9;
function img10() {
portraits_mc.loadMovie(urls[9]);
}
portraits_btn10.onRelease = img10;
function img11() {
portraits_mc.loadMovie(urls[10]);
}
portraits_btn11.onRelease = img11;
function img12() {
portraits_mc.loadMovie(urls[11]);
}
portraits_btn12.onRelease = img12;
function img13() {
portraits_mc.loadMovie(urls[12]);
}
portraits_btn13.onRelease = img13;
function img14() {
portraits_mc.loadMovie(urls[13]);
}
portraits_btn14.onRelease = img14;
function img15() {
portraits_mc.loadMovie(urls[14]);
}
portraits_btn15.onRelease = img15;
function img16() {
portraits_mc.loadMovie(urls[15]);
}
portraits_btn16.onRelease = img16;
function img17() {
portraits_mc.loadMovie(urls[16]);
}
portraits_btn17.onRelease = img17;
function img18() {
portraits_mc.loadMovie(urls[17]);
}
portraits_btn18.onRelease = img18;
Hey CK19!
Wish I could say that it’s just a minor code change, but it’s probably more than that.
I did a quick check for the needed code but didn’t find it yet. But the process goes like this… since you will have two images showing at the same time, you know that you will need two separate “containers” or _mc to display them. The fade in/out comes from alpha control of the that mc (0 to 100). The second, or overlapping mc always needs to be on top, so you’ll need to give it a higher level than the image it’s replacing.
In case I can’t find the code, check out, www.gotoandlearn.com
or www.flashkit.com
Best wishes,
EfV
Bookmarks