Skip to main content
June 20, 2006
Question

trace = undefined

  • June 20, 2006
  • 3 replies
  • 369 views
Hi... this is a script i'm using to duplicate a button for each item in a menu, each button is allocated a 'selectcText' variable (which is taken from an external txt file). (see attached code)
on each frame of my _root. timeline i need to trace the next selectcText,
e.g. on frame 9, i need to trace the selectcText allocated to button selectc1
on frame 10, i need to trace the selectcText allocated to button selectc2
on frame 11, i need to trace the selectcText allocated to button selectc3

i've tried creating an array on the root...
_root.myArray = new Array();
and pushing the trace...
_root.myArray.push(subMenuItem.selectcText)

on my root, n = 0. and i've got a movieclip acting as a button to go to next frame and trace the correct text...

onRelease = function () {
var traceVar = _root.myArray[_root.n];
trace(traceVar);
_global.lastTrace = selectcText;
_root.n++;
_root.nextFrame();
};

i must be going about this all wrong, cos it just isnt working, my trace is undefined.
pleeeeeeaaaaaaase help, been hacking away at this for months now...
This topic has been closed for replies.

3 replies

June 21, 2006
YOU ARE DA MAN!!!!

fank u.
Inspiring
June 21, 2006
Glad to help.

greets,
blemmo
June 21, 2006
thanks mate, but i've tried it. still isnt working. undefined.
heres the basic fla. i've deleted alot of script that isnt relevant, but might have missed some.
the bit you want (i think) is in 'menu01' and the 'next button'

http://www.klabak.f2s.com/k_test.zip

if you get a sec please have a look, and anyone else that can help! thanks in advance.
Inspiring
June 21, 2006
In the next button, change
_global.lastTrace = selectcText;
to
_global.lastTrace = traceVar;
and it will load a picture (a.jpg, b.jpg etc.). The 'selectcText' var doesn't exist in that scope, thus it results in 'undefined'.

Hope that's what you wanted.

greets,
blemmo
June 21, 2006
would it help if i post an FLA?
please guys really need help...
Inspiring
June 21, 2006
_root.myArray.push(subMenuItem.selectcText)

should be wrong, because subMenuItem is your 'prototype' for the sub menus, if I understand it right. The text is assigned to

this["selectc"+i],

so it should be

_root.myArray.push( this["selectc"+i].selectcText )

Try if that helps.

cheers,
blemmo