• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Flash Website - Gallery Issue

Stroker

Limp Gawd
Joined
Dec 7, 2005
Messages
166
Hi everybody, I'm hoping I can find some help here with my problem because I am really stuck. I am pretty new to AS3 and can't figure this out for the life of me!

I followed this flash tutorial for creating a photo gallery
http://www.flashmagazine.com/Tutoria...photo_gallery/
and am having the following issue:

When I preview my .fla in flash professional the gallery did not disappear so I added (as per the advice of a comment on that site) clickclear events. These make the gallery visually disappear but if you click where a picture was it will still open it. Does anyone know how I can fully clear the gallery when navigating away from the page?

Any help is GREATLY appreciated!!!

Here is my code for the gallery:

import fl.containers.UILoader;
import caurina.transitions.*;

//---------loading the external xml file-------
var urlRequest:URLRequest = new URLRequest("pics.xml");
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
myXML.ignoreWhitespace = true;
urlLoader.addEventListener(Event.COMPLETE,fileLoad ed);
urlLoader.load(urlRequest);
//--------holds the paths to the thumbnails-------
var arrayURL:Array = new Array();
//--------holds the paths to the big photos-------
var arrayName:Array = new Array();
//--------holds the thumbnail objects-------
var holderArray:Array = new Array();
//--------represents the number of collumns-------
var nrColumns:uint = 4;
//-------represents the container of our gallery
var sprite:Sprite = new Sprite();
addChild(sprite);
var thumb:Thumbnail;
//-------- the thumbnails container-------
var thumbsHolder:Sprite = new Sprite();
sprite.addChild(thumbsHolder);
//-------- the photoLoader container-------
var loaderHolder:Sprite = new Sprite();
loaderHolder.graphics.beginFill(0x333333,1);
loaderHolder.graphics.drawRect(0,0,1024,680);
loaderHolder.graphics.endFill();
loaderHolder.x = 5000;
loaderHolder.y = 160;
sprite.addChild(loaderHolder);
//-------- loads the big photo-------
var photoLoader:UILoader = new UILoader();
photoLoader.width = 1024;
photoLoader.height = 680;
photoLoader.y = 0;
photoLoader.x = 0;
photoLoader.buttonMode = true;
photoLoader.addEventListener(MouseEvent.CLICK,onCl ickBack);
loaderHolder.addChild(photoLoader);

/* we loop through the xml file
populate the arrayURL, arrayName and position the thumbnails */
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
for (var i:int=0; i<xmlList.length(); i++) {
var picURL:String = xmlList[ i ].url;
var picName:String = xmlList[ i ].big_url;
arrayURL.push(picURL);
arrayName.push(picName);
holderArray[ i ] = new Thumbnail(arrayURL[ i ],i,arrayName[ i ]);
holderArray[ i ].addEventListener(MouseEvent.CLICK,onClick);
holderArray[ i ].name = arrayName[ i ];
holderArray[ i ].buttonMode = true;
if (i<nrColumns) {
holderArray[ i ].y = 225;
holderArray[ i ].x = i*150+475;
} else {
holderArray[ i ].y = holderArray[ i-nrColumns].y+150;
holderArray[ i ].x = holderArray[ i-nrColumns].x;
}
thumbsHolder.addChild(holderArray[ i ]);
}
}
//----handles the Click event added to the thumbnails--
function onClick(event:MouseEvent):void {
photoLoader.source = event.currentTarget.name;
//Tweener.addTween(thumbsHolder, {x:-2000, time:.1, transition:"easeInElastic"});
Tweener.addTween(loaderHolder, {x:328, time:.1, transition:"easeInElastic"});
Tweener.addTween(thumbsHolder, {alpha:0, time:.7, transition:"linear"});
Tweener.addTween(loaderHolder, {alpha:1, time:.7, transition:"linear"});
}
//----handles the Click event added to the photoLoader----
function onClickBack(event:MouseEvent):void {
//Tweener.addTween(thumbsHolder, {x:0, time:.1, transition:"easeInElastic"});
Tweener.addTween(loaderHolder, {x:5000, time:.1, transition:"easeInElastic"});
Tweener.addTween(thumbsHolder, {alpha:1, time:.7, transition:"linear"});
Tweener.addTween(loaderHolder, {alpha:0, time:.7, transition:"linear"});
}



//-----Clears Gallery
Bio_Button_No_Bar.addEventListener(MouseEvent.CLIC K, clickClear_Bio_No_Bar_1);
function clickClear_Bio_No_Bar_1(event:Event):void {
Tweener.addTween(loaderHolder, {alpha:0, time:.5, transition:"linear"});
Tweener.addTween(thumbsHolder, {alpha:0, time:.5, transition:"linear"});
}
Home_Button_No_Bar.addEventListener(MouseEvent.CLI CK, clickClear_Home_No_Bar_1);
function clickClear_Home_No_Bar_1(event:Event):void {
Tweener.addTween(loaderHolder, {alpha:0, time:.5, transition:"linear"});
Tweener.addTween(thumbsHolder, {alpha:0, time:.5, transition:"linear"});
}
Contact_Button_No_Bar.addEventListener(MouseEvent. CLICK, clickClear_Contact_No_Bar_1);
function clickClear_Contact_No_Bar_1(event:Event):void {
Tweener.addTween(loaderHolder, {alpha:0, time:.5, transition:"linear"});
Tweener.addTween(thumbsHolder, {alpha:0, time:.5, transition:"linear"});
}
Portfolio_Button_Bar.addEventListener(MouseEvent.C LICK, clickClear_Portfolio_Bar_1);
function clickClear_Portfolio_Bar_1(event:Event):void {
Tweener.addTween(loaderHolder, {alpha:0, time:.5, transition:"linear"});
Tweener.addTween(thumbsHolder, {alpha:0, time:.5, transition:"linear"});
}
 
Nevermind, I realized I have to put the code in a mc and then just remove the clip
 
Back
Top