2

Is is possible to click/get ActionScript values/actions using Javascript without ExternalInterface?

Is the how GreaseMonkey works? Can I do that using GreaseMonkey?

2
  • almost sure you can't, however there are other interfaces that you can use to create macros to interact with flash, google for "addon macros firefox flash" or something like that Commented Dec 15, 2010 at 6:01
  • But how those putting hack flash games are injecting the code? See this userscripts.org/scripts/review/32886. I couldn't understand this part var swf = document.embeds[0] || $("flashcontent") || single("//object[contains(@data, '.swf')]"); unsafeWindow.game = swf; var actions = single("//div[@class='game_actions']") || single("//div[@class='channeHolder']") || $("header") || $("content") || document.body; Commented Dec 15, 2010 at 10:27

2 Answers 2

2

how about

swf=document.embeds[0];//or 1 or 2 etc
swfvar1=swf.GetVariable("swfvariable");
swfvar2="something";
swf.SetVariable("swfvariable",swfvar2);

its GetVariable("swfvar"); with the var name as a string and SetVariable("swfvar",jsval); with the swfvar name as a string and the js value whatever you want

to execute function, there are 2 ways 1. using the code above with the var swf, swf.SwfFunc(params); simple, right? yes.

2.again with code above swf.GetVariable("SwfFunc(params)"); since it gets the value of the function, it executes it all to look for a return value, might be bad if the params are ugly with overlapping quotes because there are already quotes in the call

personally, I like method 2 because it can be used for other purposes too, like executing code. like this

swf.GetVariable("
function(){
//whatever
}");

I find this very useful, but remember you must escape the quotes in that function it is actually like injecting an eval statement, but better

Sign up to request clarification or add additional context in comments.

Comments

1

it's rather hard but maybe possible to implement LocalConnection or NetStream direct connection (for using the send() method) in javascript :)

the other way is to use something as a buffer that'll be checked by SWF and javascript every certain time. A simple php script will be a good buffer, also maybe this data could be stored in browser adress bar after#

and another funny idea: you can develop an SWF messenger that will be loaded every time you need to pass a message to flash. message is passed to the messenger as get variables and it will create a LocalConnection with the main swf and pass data there. but the only way to call js from flash is navigateToURL or maybe sendToURL

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.