|
|
Flash Help Anyone?
|
|
|
|
Senior User
Join Date: Feb 2007
Status:
Offline
|
|
So I'm probably overlooking something fairly obvious here, but my "activated" variable in the script below isn't updating, any ideas? (The script is meant to hide/show a mvc depending on its active state.)
Thanks in advance for any help!
var groupinfo:Array = [newsbox];
var GROWSTART:Number = 10;
var GROWSTOP:Number = 19;
var SHRINKSTART:Number = 20;
var SHRINKSTOP:Number = 29;
function doOn() {
if (this._currentframe > SHRINKSTART && this._currentframe < SHRINKSTOP) {
this.gotoAndPlay(GROWSTART + SHRINKSTOP - this._currentframe);
} else {
this.gotoAndPlay(GROWSTART);
}
}
function doOff() {
if (this._currentframe > GROWSTART && this._currentframe < GROWSTOP) {
this.gotoAndPlay(SHRINKSTART + GROWSTOP - this._currentframe);
} else {
this.gotoAndPlay(SHRINKSTART);
}
}
function init() {
for (var mc in groupinfo) {
if (activated == false) {
groupinfo[mc].onRelease = doOn;
activated = true
} else if (activated == true){
groupinfo[mc].onRelease = doOff;
activated = false
}
}
}
init();
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Dec 2000
Status:
Offline
|
|
I haven't done any Flash programming before, but it looks vaguely like JavaScript. I would think you would need to declare the "activated" variable somewhere before you can use it, otherwise it is probably just declared in that one if() statement and then destroyed.
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Feb 2007
Status:
Offline
|
|
I've tried declaring "activated" before the function and elsewhere as a global variable, but still don't seem to have any luck, thanks though!
Any more thoughts anyone? Obviously I'll post back here if I figure something out!
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2006
Location: London
Status:
Offline
|
|
|
MacBook Pro 2.2 i7 | 4GB | 128GB SSD ~ 500GB+2TB Externals ~ iPhone 4 32GB
Canon 5DII | EF 24-105mm IS USM | EF 100-400mm L IS USM | 50mm 1.8mkII
iMac | Mac Mini | 42" Panasonic LED HDTV | PS3
|
|
|
|
|
|
|
|
Senior User
Join Date: Feb 2007
Status:
Offline
|
|
Heh, true true, no worries though, here's the solution:
var groupinfo:Array = [newsbox];
var activated:Boolean = false;
var GROWSTART:Number = 10;
var GROWSTOP:Number = 19;
var SHRINKSTART:Number = 20;
var SHRINKSTOP:Number = 29;
function doOn() {
if (this._currentframe > SHRINKSTART && this._currentframe < SHRINKSTOP) {
this.gotoAndPlay(GROWSTART + SHRINKSTOP - this._currentframe);
} else {
this.gotoAndPlay(GROWSTART);
}
activated = true;
init();
};
function doOff() {
if (this._currentframe > GROWSTART && this._currentframe < GROWSTOP) {
this.gotoAndPlay(SHRINKSTART + GROWSTOP - this._currentframe);
} else {
this.gotoAndPlay(SHRINKSTART);
}
activated = false;
init();
};
function init() {
for (var mc in groupinfo) {
if (!activated){
groupinfo[mc].onRelease = doOn;
} else {
groupinfo[mc].onRelease = doOff;
}
}
};
init();
stop();
(Just In case someone googles and ends up here...)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|