Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot link scenes (from home to photo gallery) 1

Status
Not open for further replies.

carmen77

Programmer
Jun 12, 2005
5
US
Hi,
I'm a newbie to Flash MX.
Have set up a scene (home page) to another scene (photo gallery)... The scenes when tested separately are working fine but when I tried to view the photo gallery using a button on the home page, it replays the home page... Another problem that i faced was after loading the photo, the photo remains there when i navigate to other scenes. Can anyone pls help??? Thks in advance!!!

In home page, the button that links to photo gallery has the following action script:

on(release){
gotoAndPlay("Scene 2");
};

In the photo gallery (Scene 2), the movie clip has the following action script:

onClipEvent (load) {
_root.gotoAndStop(2);
}

And the action script to display the photos is:
Frame 1:


_global.a_th = 80;
_global.a_ta = 70;
_global.colunas = 3;
_global.linhas = 3;
var PhotoAlbum = {thumbs:[]};
photo_xml = new XML();
photo_xml.ignoreWhite = true;
stop();

Frame 2:

photo_xml.onLoad = function() {
bjork_th.html = true;
bjork_th.htmlText = "<p align=\"center\"></p>";
Photos_Bjork(0);
};
_global.Photos_Bjork = function(carregar) {
var photos = photo_xml.firstChild.childNodes;
var p_thumbs = photo_xml.firstChild.attributes.thumbs,
p_photos = photo_xml.firstChild.attributes.bjorks;
var i = carregar;
for (var l = 0; l<linhas; l++) {
for (var c = 0; c<colunas && i<photos.length; c++, i++){
var thumb = bjork_th.createEmptyMovieClip("thumb_"+i, i);
PhotoAlbum.thumbs.push(t);
thumb._y = l*a_th;
thumb._x = c*a_ta;
thumb.createEmptyMovieClip("photos", 1);
thumb.photos.loadMovie(p_thumbs+"/"+photos.attributes.thumb);
thumb.dimensoes = photos.attributes;
thumb.onRelease = function() {
bjork_photo._parent.alvo.unloadMovie();
bjork_photo.dimensoes = this.dimensoes;
bjork_photo.onEnterFrame = function() {
this._width += (this.dimensoes.largura-this._width)/3;
this._height += (this.dimensoes.altura-this._height)/3;
bjork_th._x = this._x+(this._width/2)+5;
bjork_th._y = this._y-(this._height/2);
if (Math.round(this._width) == Math.round(this.dimensoes.largura) && Math.round(this._height) == Math.round(this.dimensoes.altura)) {
this._width = this.dimensoes.largura;
this._height = this.dimensoes.altura;
delete this.onEnterFrame;
this._parent.createEmptyMovieClip("alvo", 1);
this._parent.alvo._x = this._x-(this._width/2);
this._parent.alvo._y = this._y-(this._height/2);
this._parent.alvo.loadMovie(p_photos+"/"+this.dimensoes.bjork_bw);
}
};
};
}
}
};
photo_xml.load("photos.xml");
stop();
 
A bit of confusion in both your questions...

That said, never target a scene name again in your Flash life! Always only target a labeled frame in the targeted scene, and add the path to the main timeline (_root, _level0, and/or possibly _parent...) to your script.

Label the targeted frame in the targeted scene with a unique label such as my_target1 (no number only labels or at least not starting with a number, no caps, no spaces and no special characters other that the underscore...) and only target that labeled frame in your button's script, adding the path to the main timeline...

on(release){
_level0.gotoAndPlay("my_target1");
// or gotoAndStop("my_target1");
}

Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Thks oldnewbie!!! my scene linkage now works!!!

okie, now let me try to explain my 2nd prob...

scene 1 - home page
scene 2 - photo gallery
scene 3 - guestbook

in scene 2, when click at the thumb, the pic will be enlarged... but when i navigate to other scenes, eg scene 3, the enlarged pic remains on top of current scene...
really appreciate your help!!!

have uploaded the .fla & .swf files for your reference. (PhotoGalleryProb.zip)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top