| View previous topic :: View next topic |
| Author |
Message |
GoblinMaster Advanced Cheater
Reputation: 0
Joined: 05 Jul 2007 Posts: 79
|
Posted: Wed Aug 19, 2009 3:59 pm Post subject: [AS3] Noobish question |
|
|
So I was rambling around on Flash and got an idea to try and change the value of an variable using an input text box for both the variable name and value (like an universal trainer), I didn't have any hopes completing this task as I am aware about my skill level but I stumbled upon a question which I hoped someone would help me with.
When entering in test as a variable it somehow seems to work on the three non determined text boxes, however it does not affect the determined value. My question is really as simple as why is it like this?
Code:
| Code: |
knapp.addEventListener(MouseEvent.CLICK, trykk)
knapp2.addEventListener(MouseEvent.CLICK, trykkigjen)
var test = 100;
var test2 = (visvar.text);
testvar.text = (test);
asdasd.text = test2;
function trykk($e:MouseEvent):void
{
var varnavn = varverdi.text;
visvar.text = varnavn;
}
function trykkigjen($e:MouseEvent):void
{
var test2 = 10;
}
|
And URL to the flash in question (ugly as hell but design wasn't ecactly on my mind at this foolishness):
| Code: |
htt p://ww w.zshare.n et/flash/643612865e598cc2/
|
Black button is 'knapp' and the red button 'knapp2', also why doesn't 'knapp2' affect 'test2'?
Anyway thank you if you even bother to look at this, and excuse my horrible formulation I am pretty sleepy right now.[/code]
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Wed Aug 19, 2009 5:20 pm Post subject: |
|
|
If you cleaned up the code, especially renamed things, people might be more willing to help.
I didn't try to understand this, but you did create variable test2 twice.
Here is a link to his project.
|
|
| Back to top |
|
 |
Polynomial Grandmaster Cheater
Reputation: 5
Joined: 17 Feb 2008 Posts: 524 Location: Inside the Intel CET shadow stack
|
Posted: Thu Aug 20, 2009 4:32 am Post subject: |
|
|
Change var test2 = 10; to test2 = 10; in trykkigjen.
You're redeclaring the test2 variable in the local scope, so it doesn't affect the global scope variable.
_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time. |
|
| Back to top |
|
 |
GoblinMaster Advanced Cheater
Reputation: 0
Joined: 05 Jul 2007 Posts: 79
|
Posted: Thu Aug 20, 2009 5:09 am Post subject: |
|
|
| Burningmace wrote: | Change var test2 = 10; to test2 = 10; in trykkigjen.
You're redeclaring the test2 variable in the local scope, so it doesn't affect the global scope variable. |
I see, however removing the var really doesn't change things, asdasd.text still won't accept that test2 is 10.
|
|
| Back to top |
|
 |
Polynomial Grandmaster Cheater
Reputation: 5
Joined: 17 Feb 2008 Posts: 524 Location: Inside the Intel CET shadow stack
|
Posted: Thu Aug 20, 2009 5:15 am Post subject: |
|
|
Well you're not actually doing anything with test2 - you set it and that's it. What are you tring to do?
_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time. |
|
| Back to top |
|
 |
|