Skip to main content

Posts

Showing posts with the label actionscript-3

Asynchronous HTTP Client for Java

As a relative newbie in the Java world, I am finding many things frustratingly obtuse to accomplish that are relatively trivial in many other frameworks. A primary example is a simple solution for asynchronous http requests. Seeing as one doesn't seem to already exist, what is the best approach? Creating my own threads using a blocking type lib like httpclient or the built-in java http stuff, or should I use the newer non-blocking io java stuff - it seems particularly complex for something which should be simple.

how to get the type of uicontrol event?

AS 3.0 code mc.addEventListener(MouseEvent.MOUSE_DOWN, eventHandler); mc.addEventListener(MouseEvent.MOUSE_UP, eventHandler); mc.addEventListener(MouseEvent.MOUSE_OVER, eventHandler); function eventHandler(e:MouseEvent):void { if(e.type == MouseEvent.MOUSE_DOWN) { //do stuff about mouseDownEvent } else if(e.type == MouseEvent.MOUSE_UP) { //do stuff about mouseUpEvent } else if(e.type == MouseEvent.MOUSE_OVER) { //do stuff about mouseOverEvent } } cocoa Code [myButton addTarget:self action:@selector(buttonEvent:withEvent:) forControlEvents:UIControlEventTouchDown]; [myButton addTarget:self action:@selector(buttonEvent:withEvent:) forControlEvents:UIControlEventTouchUpInside]; [myButton addTarget:self action:@selector(buttonEvent:withEvent:) forControlEvents:UIControlEventTouchUpOutside]; - (void)buttonEvent:(UIButton *)sender withEvent:(UIEvent *)event { // how to get a UIControlEvents Type? } I want getting the ty

ActionScript BEncoded XML file. Decoding same way as Flash:URLLoader in PHP

Hope topic is relevant :) I have a class in Action script that loads and interpretes an XML File. What I want to do is to be able to decode this file using PHP (Probably some kind of Binary Decoding) private static function interpreteXML(j:Event):void { ....... some var defined here..... var event:Event = j; var loader:URLLoader = (event.target as URLLoader); try { xml = new cXML(); xml.SetXMLString(String(loader.data)); } I'm looking for a function/class that would be able to decode XML in same way as URLLoader From what I saw in Flash AS3 Docs, URLLoader have abbility to load Binary encoded data and decode it. That's why I look for a PHP version of this method to be able to interprete files on PHP level.

AS3 to PHP - mail() function

When I click on send the textbox displays 'sending....' with no change. I'm very sure that this was working before, but the client has noticed it not working recently. I can't find the problem, please help. I have a swf with this AS3 var var_load:URLLoader = new URLLoader; var URL_request:URLRequest = new URLRequest( "http://www.blah.com/send_email_auto_response.php" ); URL_request.method = URLRequestMethod.POST; function submit(e:MouseEvent):void { if( contact_name.text == "" || contact_email.text == "" || contact_subject.text == "" || contact_message.text == "" ) { message_status.text = "Please fill up all text fields."; } else if( !validate_email(contact_email.text) ) { message_status.text = "Please enter the valid email address."; } else { message_status.text = "sending..."; var email_data:String

PHP if else - proper use of "else”

A professor told me long ago to use else when "chaining" multiple conditions in a series (I was still learning). Now that I've been tinkering with several frameworks and CMS years later, I find it quite amusing that what I was taught to do isn't necessarily so. I was taught to use else in between a series of conditions: function double(param){ if(param==1){ return param+=1; } else if(param==2){ return param+=2; } else{ return false; } } Nowadays, I seem to see this, which I was warned long ago NOT to do: function double(param){ if(param==1){ return param+=1; } if(param==2){ return param+=2; } return false; } This sample code might not work, but the idea is there: Is it necessary to use else in between every condition? If so (or not so), what should I look out for when using either way? There must be something that caused my professor to tell me such thing.

How to Bind SWFs to a Host?

I'm working on a major Flash project that is going to be the core content of a site. As most of you well know, almost any site can be entirely copied by copying the cached files and the hierarchy (files and folders structure), and it would run without problems on an Apache server with PHP enabled, if used. What I would like to know is: How to bind SWF files to run on a specific host? The SWFs will be encrypted, so outsiders won't have access to the methods used to stop the SWF from running on a different host, question is: what method to use? I think the solution could be hardcoding the host IP inside the SWF, so if the SWF is looking for 123.123.123.123, only a host with that IP would allow the SWF to run further. The issue is that AS3 alone can't discover the host IP or could it if it's trying to load a resource file? Anyway, that's why I need your help. EDIT: Ok, seems someone asked for something similar earlier: Can you secure your swf so it checks