Alert (and/or FileReference.save)

Monkey Targets Forums/Flash/Alert (and/or FileReference.save)

SlopeOak(Posted 2012) [#1]
Hi all,

Anyone know why putting in a native code AS3 "Alert" seems to hang my app? I see that Diddy does not have an AS3 version of its "showAlertDialog" function, so I assume there's some problem?

My true goal is to get AS3's FileReference.save to work, but it also seems to hang the app. Apparently you can only call FileReference.save from a direct user action, and some people have posted examples using Alerts (and the events they generate) to call FileReference.save, but, as mentioned above, Alerts also seem to hang the app...

Any insights? I just want to be able to save a file in Flash, which you can normally do easily with FileReference.save in AS3.

Thanks!


therevills(Posted 2012) [#2]
Just to let you know that Diddy's ShowAlertDialog was just to get user input for Android, if you check the other native code only the Android file has actual code in there...


Origaming(Posted 2012) [#3]
Alert is a Flex class, In AS3 you need to create your own alert dialog box,,

i already using FileReference for saved a picture and got no problem.


SlopeOak(Posted 2012) [#4]
Thanks very much! Good to know that you got FileRefernce working... means I must just be doing something wrong.

Can anyone tell me the best way to debug AS3 with Monkey? Should I be taking the produced AS files and running them in FlashBuilder or is there a better way?


SlopeOak(Posted 2012) [#5]
Ok, I've debugged it by running it in Flash Builder. The problem is that it won't let me call FileReference.save unless it's in response to a direct user action. But as far as I know (I'm newish to Monkey), you just sort of poll for input, you don't have any sort of callbacks or events.

So, Origaming, how did you manage to call FileReference in a way that was valid?

Thanks again!


SlopeOak(Posted 2012) [#6]
Ok, sorry for spamming the thread, but this'll be the last post :)

I solved it by creating an event listener in Flash itself, and calling the FileReference.save from the triggered event. This is still not ideal, as I'd prefer to call it from Monkey code, so if Origaming has any slick solution, I'm all ears!

But just wanted to post my solution in case other folks search for FileReference.save, looking for help.


Origaming(Posted 2012) [#7]
i have post my module on google code :
http://code.google.com/p/orimonkey/

saveSnapShot function

feel free to ask