actionscript

Get IP address using Action Script?

一世执手 提交于 2019-12-05 07:51:29
Is it possible to get client IP address through Flash (swf) Action Script 3 and then pass it to php file to store it in database? No need to do it in flash, just do it on your server in php "$ip=@$REMOTE_ADDR;" No, the client IP address is not available in ActionScript 3. The recommended approach is to have it reflected by server-side code. See http://www.actionscript.org/forums/showthread.php3?s=&threadid=20123 function GetUserIP() { var js="function get_userIP(){return java.net.InetAddress.getLocalHost().getHostAddress();}"; var userIPInfo:String=ExternalInterface.call(js).toString(); return

Why compiling into intermediate code?

我只是一个虾纸丫 提交于 2019-12-05 06:44:36
Why do Actionscript, Java, C#, etc. compile into intermediate code? I'm aware of cross-platform benefits of using intermediate code. The question is: What is the benefit of compiling to intermediate code, compared to scripts (JS, Python, PHP, Perl, etc.) that are interpreted? Is it just for code obfuscation? Or what? In addition what is the benefit compared to compiling to native code? First of all historically java was targeted to mobiles and embedded devices with very limited CPU/memory, and JVM on such devices can't do any intensive optimization, like modern JITs do for now. So java

Difference between Array and ArrayCollection(Flex)

假装没事ソ 提交于 2019-12-05 05:04:53
What's the difference between array and arraycollection? First, the ArrayCollection is designed for the Flex framework. It acts like a Proxy for a given Array instance. This means it can listen for modifications made to the source Array and update it self when this happens. It also contains a subset of additional methods required specifically by the framework (have a look at the IList implementation for instance). One important difference is that ArrayCollection raises events whenever it is modified. This allows you to do data binding on it more effectively than you could do on an Array . An

How to invoke an ActionScript method from JavaScript (HTMLLoader) object in AIR?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 04:25:39
问题 So I have an Application Sandbox HTMLLoader object which I create in AIR and simply want to call ActionScript methods from JavaScript. In Flash, this is accomplished through our trusty ExternalInterface.addCallback() function. However in AIR, things are quite a bit different, and I just can't seem to get it to work. Here is a simplified overview of my project: My AIR (ActionScript) main: public class Main extends Sprite { public var _as3Var:String = "testing"; public function as3Function()

Actionscript Date Comparison

こ雲淡風輕ζ 提交于 2019-12-05 03:58:50
In my Actionscript code I have two dates: var date1:Date = new Date(2011,1,1); var date2:Date = new Date(2011,1,1); This doesn't work: var equal:Boolean = date1 == date2; From reading I've found that this is a working alternative since it just gets the number of milliseconds from a standard point in time. var equal:Boolean = date1.getTime() == date2.getTime(); So my questions are: Why doesn't the normal equality operator work on Dates in actionscript? ">" as well as "<" operators seem to work fine, but can they be trusted? Why would they work but not the equality operator? Is there a standard

How can you overload a function in ActionScript?

元气小坏坏 提交于 2019-12-05 00:58:10
I want a function to be able to take in various types. AS3 doesn't support overloading directly... so I can't do the following: //THIS ISN'T SUPPORTED BY AS3 function someFunction(xx:int, yy:int, someBoolean:Boolean = true){ //blah blah blah } function someFunction(arr:Array, someBoolean:Boolean = true){ someFunction(arr[0], arr[1], someBoolean); } How can I work around it and still have a function that is able to take arguments of various types? zzzzBov If you just want to be able to accept any type, you can use * to allow any type: function someFunction( xx:*, yy:*, flag:Boolean = true ) {

Flex/actionscript snapshot

天大地大妈咪最大 提交于 2019-12-04 22:19:20
var bmd:BitmapData = ImageSnapshot.captureBitmapData(someSprite); trace("bmd size "+getSize(bmd)); var bounds:Rectangle = new Rectangle(0, 0, bmd.width, bmd.height); var snapshot:ImageSnapshot = new ImageSnapshot(0,0,bmd.getPixels(bounds)); //var snapshot:ImageSnapshot = ImageSnapshot.captureImage(someSprite); var file:FileReference = new FileReference(); file.save(snapshot.data,'abc.png'); In the above code after saving the file, when I try to open it, I get "This is not a valid bitmap file". I have tried 2-3 different viewers. To extend Amarghosh's answer, look to the constructor of

How to change the coordinate origin in Flash's stage with Actionscript?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 20:42:26
I think I did this before but can't find the code. Flash as many other graphical frameworks use the top-left corner as the coordinate origin (0,0) because it's how the underlying memory model is by convention. But it would be really simpler for my calculations if the origin was in the center of the stage, because all the game revolves around the center and uses a lot of trigonometry, angles, etc. Is there some built-in method like Stage::setOrigin( uint, uint ); or something like that? Create a MovieClip or Sprite and add that to the stage as your root object (instead of adding to the Stage)

Libraries for text animation in Flex / Actionscript? [closed]

∥☆過路亽.° 提交于 2019-12-04 19:42:53
Are there any good libraries for cool text animation effects for use in Actionscript (for use in an intro screen or banner). I've given up tryin to use Flash itself because that takes forever, and I dont know which of the many flash text animation tools to choose from. I'd like to be able to dynamically product cool text effects with different messages. There is http://www.txeff.com/ which is pretty awesome although a little expensive. It even has an effect editor . Extensive list of AS3 tweening libraries (among other things) at AS3 Code Libraries Hey! check out the TextAnim library. A class

open and display a pdf file using actionscript for mobiles (iOS)

眉间皱痕 提交于 2019-12-04 19:32:46
Currently I am working with Adobe AIR and getting practice with ActionScript. My aim is to display a PDF file in a view (iPad view in specific). To do so, I was using URLRequest to specify the location of the PDF and HTMLLoader for load the PDF. However is not working, I read in the documentation the following: HTMLLoader class. AIR profile support: This feature is supported on all desktop operating systems, but is not supported on mobile devices or on AIR for TV devices. For this reason I would like to ask you folks if you have done something similar, or do you know a workaround for it?