Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Flash Help Anyone?

Flash Help Anyone?
Thread Tools
Senior User
Join Date: Feb 2007
Status: Offline
Reply With Quote
Jun 9, 2007, 06:57 AM
 
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
Reply With Quote
Jun 9, 2007, 10:43 PM
 
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.


My name's ...uh... it's a bummer man.
     
Senior User
Join Date: Feb 2007
Status: Offline
Reply With Quote
Jun 10, 2007, 05:51 AM
 
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
Reply With Quote
Jun 10, 2007, 06:13 AM
 
Id probably try a flash forum Adobe - Flash Support Forums
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
22" Viewsonic | 32" Panasonic HDTV | PS3
     
Senior User
Join Date: Feb 2007
Status: Offline
Reply With Quote
Jun 10, 2007, 07:00 AM
 
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...)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:29 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2