Welcome, Guest. Please login or register.
Did you miss your activation email?
02/07/12, 09:17
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash MX 2004 (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Andresss, papachan)
| | |-+  flash var question thanks...
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: flash var question thanks...  (Read 3187 times)
melnet
Server what's that
*
Posts: 2


View Profile Email
« on: 09/13/08, 01:36 »

Hi

Code:
num_array = new Array("null", "1", "1", "2", "2", "3", "3");
data_array=new Array("null");
mc_array = new Array("null");
ttl_card = 6;
what = 0;
function store_num(mc:MovieClip, num:Number) {
mc_array.push(mc);
data_array.push(num);
mc.gotoAndStop(num);
//mc.fig_no = num;
trace(num);
}
for (i=1; i<=ttl_card; i++) {
what = this["data"+i];
store_num(_root["card_mc"+i], what);
}
for (i=1; i<=ttl_card; i++) {
mc_array[i].onRelease = function() {
trace(data_array[i]);
};
}

i have input value into every mc's "what" but dont konw why all of var are undefined.


Thanks...
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6161


View Profile WWW Email
« Reply #1 on: 09/13/08, 02:10 »

does the mc exist, before you call that function?
if it does not, how would the function receive a pointer to a instance - and a nonexistant MC cannot receive a release event! - ?
And if you just loaded it, did you wait for the loaded event, to make sure it is completely loaded, before you do any action to it?
I realy don get the idea behind this funtion - why 3 loops?

Why did you post this to Flash MX 2004? Are you using this old version?
« Last Edit: 09/13/08, 02:12 by Ronald Wernecke » Logged

happy flashing
Cool
Ronald
melnet
Server what's that
*
Posts: 2


View Profile Email
« Reply #2 on: 09/13/08, 02:51 »

Code:
for (i=1; i<=ttl_card; i++) {
mc_array[i].onRelease = function() {
trace(data_array[i]);
};
}
if i change above code to following code:
mc_array[1].onRelease = function() {
trace(data_array[1]);
};
mc_array[2].onRelease = function() {
trace(data_array[2]);
};
mc_array[3].onRelease = function() {
trace(data_array[3]);
};
mc_array[4].onRelease = function() {
trace(data_array[4]);
};
mc_array[5].onRelease = function() {
trace(data_array[5]);
};
mc_array[6].onRelease = function() {
trace(data_array[6]);
};
it works....i dont konw where gets wrong...
acutally, it's a game. user takes a pair of cards.

Thanks..... Huh

Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!