flash5:: eval() fails in swf , works in fla ?
Hi , weirdness , I have a flash object , during it lifetime it has to use eval()
//variables already loaded e.g count_1 - count_7 exist and can be traced
// 'x' exists and can be traced
_root.num_ims = eval('count_'+x);
if x = 5 and count_5 = 10 then _root.num_ims should equal 10 and indeed it does when testing (in flash) as expected , but when using in the output swf in the browser the eval() call is failing , everything else works just fine.
and its driving me potty ~
any one seen this behaviour before ?
Well, never having worked with ActionScript I can't say anything final, but I know that the compact ECMAScript specification allows dropping of eval and the like for speed when embedding the language.
I suggest you replace the variables count_1 through count_7 with an array count instead, and use array notation count[x] instead of eval('count_'+x). Additionally, array lookup is many times faster than eval, so that might even speed the execution up.
Hey Liorean , that worked a treat , the variables come via GET so I can't get directly at the array , but simply loading the loaded variables into an array indeed did the job :thumbsup:
I swear I have used eval in flash-web-applications before , however since your suggestion works I am keeping quiet so cheers !
|All times are GMT +1. The time now is 01:26 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.