What's new

Need a hand with some ActionScript


Locutus

Tentacle Monster
Joined
Dec 8, 2012
Messages
355
Reputation score
31
Hey. So I'm trying to decompile a flash game to get a cheat code for said game, which unlocks some features, mostly because I've always wanted to know how to do stuff like this. I've decompiled it, and found the part of the code where it checks the text string you've entered. The problem I'm encountering is (and here is where my inexperience with ActionScript really hurts), it seems to be using namespaces to obscure required text. Part of the code looks like this, for example

Code:
if (inputCode.text.toLowerCase() == ((((((((((((((((a[1] + a[6]) + a[6]) + a[2]) + " ")
(that's only part of it, as you can tell from the amount of brackets it's actually much longer).

Now, as far as I can tell, the namespace being used is the built in one (" http://adobe.com/AS3/2006"), but I don't actually know how to reverse engineer it from here, or if it's even possible.

Anybody who actually knows AS3 care to lend a hand? I realise the obvious point that I could just post the flash and let you have at it, but I'd rather do it by hand so I know what to do in the future, ya know? :p
 

freeko

Banned
Joined
Dec 9, 2010
Messages
1,892
Reputation score
160
Re: Need a hand with some ActionScript

Would it be possible to post (likely spoilered or in private) the whole block of code? Without seeing the whole block its like being asked to solve a 500 piece puzzle with 100 pieces.
 
OP
L

Locutus

Tentacle Monster
Joined
Dec 8, 2012
Messages
355
Reputation score
31
Re: Need a hand with some ActionScript

Yeah, I was worried it might be like that. Do you mean the full AS code for the entire SWF? Because that's several times the length of the character limit, I'm not sure how to get around that, unless spoiler tags ignore that and I just fucked up when I tried to use them. Or do you mean only a certain part? In case you only mean the section of code I posted a portion of earlier, here is (as far as my untrained eye can tell) the full part
Code:
public function startGame(_arg1:MouseEvent):void{
			btnIntroStart.removeEventListener(MouseEvent.CLICK, startGame);
			if (inputCode.text.toLowerCase() == ((((((((((((((((a[1] + a[6]) + a[6]) + a[2]) + " ") + a[7]) + a[0]) + a[4]) + " ") + a[8]) + a[3]) + " ") + a[4]) + a[9]) + a[10]) + a[1]) + a[3])){
				bConsoleEnabled = true;
			};
			gotoAndStop(3);
 

Logos

Demon Girl
Joined
Feb 4, 2015
Messages
60
Reputation score
1
Re: Need a hand with some ActionScript

Looks like it's just calling various positions of the array a[], the contents of which I don't know.

Taking a shot in the dark, perhaps "bggc haf id ejkbd" if a[] just contains the alphabet.

If that doesn't work, you might try importing the namespace used and run the following code:
Code:
package 
{ 
    import flash.display.Sprite; 
    import flash.text.*; 
 
    public class TextWithImage extends Sprite 
    { 
        private var myTextBox:TextField = new TextField(); 
        private var myText:String = ((((((((((((((((a[1] + a[6]) + a[6]) + a[2]) + " ") + a[7]) + a[0]) + a[4]) + " ") + a[8]) + a[3]) + " ") + a[4]) + a[9]) + a[10]) + a[1]) + a[3])); 
 
        public function TextWithImage() 
        { 
            addChild(myTextBox); 
            myTextBox.text = myText; 
        } 
    } 
}
 
OP
L

Locutus

Tentacle Monster
Joined
Dec 8, 2012
Messages
355
Reputation score
31
Re: Need a hand with some ActionScript

So, uh, I solved the problem in a really obvious way I'm embarrassed I didn't do automatically :eek:

I just added an else statement after it checks the input text to turn it on anyway :p

Maybe when I get better at this type of thing I'll actually solve it "properly".

Thanks for trying to guide my thick skull through it anyway, guys.
 
Top