| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#11 |
|
Holosuit User
|
Sure
But mind it, there's no coding outside the function definitition, and, nope, no language allows coding outside the functions, except, maybe Assembler not those you mentioned, that's for certain.
__________________
The .NET open source editor for Flash and web developers *This would be my contribution to the project* couchsurfing if you need it |
|
|
|
|
|
#12 |
|
Registered User
Join Date: Oct 2009
Posts: 16
|
Ummm sorry - did not get it - so you are saying there is absolutly no way, not is actionscript 2 not in actionscript 3 not using Flash CS 2/3/4 not using Flex IDE, not using externale .as files to run code outside of a function?
P.S. >no language allows coding outside the functions, except, maybe Assembler not those you mentioned ehhh in C# or javascript var i=5; i=4; outside of a function is perfectly legal and works... and always worked... Last edited by Aphalin; 11-03-2009 at 08:30 PM.. |
|
|
|
|
|
|
|
|
#13 |
|
Holosuit User
|
Just for the general info:
that code will work in JS because all the JS code is called from an eval() function which is in it's turn called from some browser onLoad function, which is called by some other function etc. You may not see it right away, but, that doesn't mean it doesn't exist. Similarly, C#, launches the main thread, which in it's turn launches other threads, which are basically functions etc, etc. Well, if you don't like the "function" keyword, then, you know, you can just put more line breaks after it and before the next function, so you won't see them in the code editor, that will basically have the same effect...
__________________
The .NET open source editor for Flash and web developers *This would be my contribution to the project* couchsurfing if you need it Last edited by wvxvw; 11-03-2009 at 09:31 PM.. |
|
|
|
|
|
#14 |
|
Registered User
Join Date: Oct 2009
Posts: 16
|
This is very well known (i think everythink but bios is then a function). My point was only that all languages by "their" standart allow outfunction scripting (since Flash action script has even loger stack then javascript, when is played in browser - and same length with C# that uses silverlight). And that is extremely weird for me, since in no tutorial it is mentioned, not many people seems to know about it (how come???), and ECMA standarts allow outfunction scripting (not sure about new 2007 ECMA standarts but actionscript 2 is older i think)
But what to do... i guess i ll have to go through all of my 50k of code lines by hands ((( >"if you don't like the "function" keyword If only the problem was that i do not like functions keyword so much... > line breaks after it and before the next function Won't work all variables will be gone after the execution. Thank you for the reply. Last edited by Aphalin; 11-03-2009 at 10:14 PM.. |
|
|
|
|
|
#15 | |||
|
Holosuit User
|
Well, you see... MXML isn't really a proper place for putting scripts... it's for layout, that is to call the methods of the class, for which it is a visual representation. MXML language is in no way an ECMAScript language... well, I think, you would've notice, it is basically an XML variant... it is a template for generating AS3 files, which, in their turn are more ES-like... But, to be honest, ES and AS aren't best friends... ES made much more sense in earlier editions of AS, when it was pure scripting language... This isn't entirely true any more...
Besides, Quote:
But, the rules of the language are so that you cannot perform operations on variables at the same place you define them, and, no modern language will allow you to do such thing, neither C#, nor Java, not even PHP. What you tried to do, would be in PHP: PHP Code:
Quote:
ActionScript Code:
Quote:
![]()
__________________
The .NET open source editor for Flash and web developers *This would be my contribution to the project* couchsurfing if you need it |
|||
|
|
|
|
|
#16 |
|
Registered User
Join Date: Jan 2008
Posts: 43
|
You're going about using Flex the wrong way, I think. Flex is essentially a markup language for generating Actionscript. The tags are basically a way to shorten/simplify Actionscript syntax at write-time, which then get expanded into actual Actionscript at compile-time. That's why you can't do what it is you're doing in the OP.
I don't have Flex Builder installed on this machine (I have it at work), but have you tried <mx:Number /> tags, if they exist? e.g. <mx:Number id="i" value="2" /> or something along those lines? /edit: WVXVW beat me to it ![]() Last edited by DocWatson; 11-04-2009 at 02:35 AM.. Reason: Beaten to the punch |
|
|
|
|
|
#17 |
|
Registered User
Join Date: Oct 2009
Posts: 16
|
wvxvw
Ehhh well... you know these long nights after days of sleep deprivation? That was the one for me Right - no scripting outside of functions (god damn 5 years of .Net were obviously a waste for me ) Thanks >Won't work all variables will be gone after the execution. >>Is just wrong. If you declare a variable in the class, than, as long as an instance of that class lives, the variable lives with it. - That was a reply to your suggestion to make a gigantic function with all other functions and variables declared in it which whould allow "global" scripting compare to functions in a function - but even if it is done in class instance, variables will still be collected once function is over, as they are local for the instance. (or did i understand you wrong first/second time?) omega_platypus >I think. Flex is essentially a markup language for generating Actionscript I personally think so too =) but too newb in ac to make public anouncment. In any case thank you all, in just 10 hours i cleared my code |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|