LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




ReplyREPLY THREAD
 
Thread Tools Display Modes
  #1  
Old 05-17-2012, 11:04 AM
Ondulado Ondulado is offline
Registered User
 
Join Date: May 2012
Posts: 4
Rep Power: 0
Ondulado is on a distinguished road
Previous Scene still shows under new scene - Scenes not clearing!! - Flash CS3 AS2

I am a novice to Flash and AS2. I am creating a website for an art gallery. It has several menu buttons at the top. The buttons goto and play various scenes containing scripts/galleries which use xml to load images. When I click on gallery 1 button the gallery works fine, then if I click on gallery 2, everything works fine, but if I then click back on gallery 1, gallery 2 still displays underneath the gallery 1. The galleries themselves are AS2. How can I make it so that no matter which order the buttons are pressed, only the content that is called on from the frame that the button points to is shown. Thanks
Reply With Quote
  #2  
Old 05-17-2012, 12:39 PM
[PAUL FERRIE]'s Avatar
[PAUL FERRIE] [PAUL FERRIE] is offline
Glasgow Flash Developer
 
Join Date: Feb 2005
Location: United Kingdom
Posts: 7,756
Rep Power: 16
[PAUL FERRIE] is on a distinguished road
Without seeing any code it is hard to say.
__________________
.:To me AS is like LEGO, Only for the big Kids :.
- Site - Blog - Glasgow Flasher - Activeden

- bringmadeleinehome.com
Reply With Quote
  #3  
Old 05-17-2012, 12:47 PM
Ondulado Ondulado is offline
Registered User
 
Join Date: May 2012
Posts: 4
Rep Power: 0
Ondulado is on a distinguished road
Button Code:

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

Scene 2, 1 code:


stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;

var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("mgallery.xml");


myGalleryXML.onLoad = function() {
_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;
_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
_root.full_x = myGalleryXML.firstChild.attributes.full_x;
_root.full_y = myGalleryXML.firstChild.attributes.full_y;


callThumbs();
createMask();
scrolling();
};

function callThumbs() {

_root.createEmptyMovieClip("container_mc",_root.ge tNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;

var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);

for (i=0; i<_root.myImagesTotal; i++) {

thumbURL = myImages[i].attributes.thumb_url;
myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth() );
myThumb_mc._y = _root.thumb_height*i;
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);


preloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHigh estDepth(),0,0,100,20);
target.my_txt.selectable = false;
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.bold = true;
format.color = 0x000000;
format.size = 10;
target.my_txt.setNewTextFormat(format);
};

preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

preloader.onLoadComplete=function(target){
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.removeTextField();
target.onRelease=function(){
callFullImage(this._name);
}

target.onRollOver=function(){
this._alpha=50;
};

target.onRollOut=function(){
this._alpha=100;
};
}

}

}

function callFullImage(myNumber) {

myURL = myImages[myNumber].attributes.full_url;
myTitle = myImages[myNumber].attributes.title;
_root.createEmptyMovieClip("fullImage_mc",_root.ge tNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;
var fullClipLoader = new MovieClipLoader();
var fullPreloader = new Object();
fullClipLoader.addListener(fullPreloader);

fullPreloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHigh estDepth(),0,400,550,20);
target.my_txt.selectable = false;
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.bold = true;
format.color = 0x000000;
format.size = 10;
target.my_txt.setNewTextFormat(format);
};

fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

fullPreloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.text = myTitle;
};
fullClipLoader.loadClip("full_images/"+myURL,fullImage_mc);

}

function createMask() {

_root.createEmptyMovieClip("mask_mc",_root.getNext HighestDepth());

mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;

mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_h eight);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);

container_mc.setMask(mask_mc);

}

function scrolling() {
_root.onEnterFrame = function() {
if (mask_mc._ymouse<(mask_mc._height*(1/3)) || mask_mc._ymouse>(mask_mc._height*(2/3))) {
container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15;
if (container_mc._y>mask_mc._y) {
container_mc._y = mask_mc._y;
}
if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
}
}
};
}
Reply With Quote
  #4  
Old 05-17-2012, 12:52 PM
[PAUL FERRIE]'s Avatar
[PAUL FERRIE] [PAUL FERRIE] is offline
Glasgow Flash Developer
 
Join Date: Feb 2005
Location: United Kingdom
Posts: 7,756
Rep Power: 16
[PAUL FERRIE] is on a distinguished road
The problem is with the movie clips being cremated dynamically. You need to create a function for clearing them before you leave the page so that they don't show up on other pages.
__________________
.:To me AS is like LEGO, Only for the big Kids :.
- Site - Blog - Glasgow Flasher - Activeden

- bringmadeleinehome.com
Reply With Quote
  #5  
Old 05-17-2012, 01:02 PM
Ondulado Ondulado is offline
Registered User
 
Join Date: May 2012
Posts: 4
Rep Power: 0
Ondulado is on a distinguished road
How do I make a function for clearing them.. is there a code I can just drop in at the end.. or on the next frame?
Reply With Quote
  #6  
Old 05-17-2012, 01:29 PM
[PAUL FERRIE]'s Avatar
[PAUL FERRIE] [PAUL FERRIE] is offline
Glasgow Flash Developer
 
Join Date: Feb 2005
Location: United Kingdom
Posts: 7,756
Rep Power: 16
[PAUL FERRIE] is on a distinguished road
Sorry there is no code that can just be dropped in. It needs to be written.

All the thumbs that where added need to be removed. The mask needs to be removed and the full image mc if it has been clicked on.

For the thumbs the function would be something like.
Actionscript:
function removeThumbs(){
for (i=0; i<_root.myImagesTotal; i++) {
removeMovieClip(container_mc['myThumb_mc'])
}
}
The code above is just an example of what you need to do it will probably not work as a "Drop in code" as you put it.
__________________
.:To me AS is like LEGO, Only for the big Kids :.
- Site - Blog - Glasgow Flasher - Activeden

- bringmadeleinehome.com
Reply With Quote


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Encrypt protects action script sintrix.com New Softwares 4 08-08-2007 05:07 AM
Glitch in my first Flash project keress Newbies 8 12-28-2006 02:49 PM
Flash Video Encoder Compare flashfever2nd New Softwares 1 05-20-2006 03:46 AM
Open Letter to Macromedia molaram General Flash 10 02-18-2005 01:29 AM
Trouble Testing Scenes in Flash MX 2004 Mac version PixelCanvas Newbies 0 12-08-2004 05:14 AM




All times are GMT. The time now is 10:01 PM.