Air (Flex) Mobile and Nexus 4 – debug and release issues
Mar 22nd
Problem 1:
Debug launcher claims that “Device appears to be offline. Restarting the device may fix the problem.”. Update of couple of android libraries helps…. but wait…
Problem 2:
Next, while building a release we get “SDK componentat air/android/device/Runtime.apk is out of date”. Putting the old android libraries back helps.
Not quite ideal, but let’s hope that a new Runtime.apk is on the way – one that will work both for debug and release.
Fixed: ‘Contact Form 7′ plugin stopped working
Oct 20th
When your contact form is telling you:
Failed to send your message. Please try later or contact administrator by other way.
Try:
- Upgrade plugin
- Create your form again (I think that this actually did the trick for me)
- Change [To] field to an email that is set up on your server (same domain)
Weird bug when looping through Dictionaries
Aug 2nd
Just encountered the same problem as Mr. midnightgreen here: http://www.actionscript.org/forums/showthread.php3?t=259338
Here’s his nice sample code in case the link above dies
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | // create a Dictionary with a single element var myDictionary:Dictionary = new Dictionary(); // var myDictionary:Object = new Object(); // if I use an Object it will run Once as it should even with Arrays as keys var myArray:Array = new Array(); // if I use Array as the key, then it will run twice even with one element! myDictionary[myArray] = 1; //myDictionary["String"] = 1; // if I use String as the Key, then it will run once var counter:int = 0; // loop through the Objects in the Dictionary, and modify them for (var objInDic:Object in myDictionary) { counter++; myDictionary[objInDic] =1; } trace("Loop has run: " + counter); // 2 //the loop run twice, even though there is only one object in the Dictionary |
TODO: post to Adobe
ListCollectionView.removeAll() – just what exactly gets removed?
Mar 11th
Short answer – all visible (i.e. not filtered-out) items get removed, NOT all items.
Consider this coding masterpiece:
1 2 3 4 5 6 7 8 9 10 11 12 13 | var ac:ArrayCollection = new ArrayCollection(['aa', 'bb', 'c']); trace(ac.length + " " + ac.source.length); ac.filterFunction = function ( item : Object ) : Boolean { return (String(item).length > 1); }; ac.refresh(); trace(ac.length + " " + ac.source.length); ac.removeAll(); trace(ac.length + " " + ac.source.length); ac.filterFunction = null; trace(ac.length + " " + ac.source.length); ac.refresh(); trace(ac.length + " " + ac.source.length); |
The output is (using SDK 4.6):
3 3
2 3
0 1
0 1
1 1
Yey, item ‘c’ cheated death in an ArrayCollection! It’s easy to see what’s happening inside ListCollectionView – Dr.Death loops only over visible items.
I’m guessing that this is intentional & not a bug in the SDK – I just think that this should be communicated better… or ideally the function could be improved to:
1 |
Note: I promise to stop complaining about poor ArrayCollection… for a while
developer.apple.com runs on… PHP?
Jan 10th
I thought Apple was luvin’ it’s own bread, I mean, WebObjects… but seems like that’s not the case:
http://developer.apple.com/enroll/selectEnrollmentType.php?t=cm
Not quite as shocking as seeing .asp there would be, but still I cannot help but wonder what’s happening behind those closed doors?
copylocale and Windows 7
Dec 20th
Copylocale runs like magic and tells you that it has copied everything just fine. Great. But the files are not there. Ah, you’re running W7, an extremely secure system. Duh, you have to enable admin mode on your command prompt before you run evil stuff like copylocale.
Apache Archiva 401 error
Dec 20th
So, your Maven settings.xml is perfect (you’ve checked like six times that the user/pass/serverId is right) but you are still getting a 401 error trying to do mvn deploy:deploy-file?
Well, once upon a time, there was this particular Archiva repository that required that I change a password for my user – it wouldn’t let me upload without changing it.
Why so strict, Archiva?
Setting up Chrome with Flash Player debugger
Oct 7th
Adobe has this covered in two KB’s, but they might be bit hard to find:
1. Installation
2. How to sort out this popup: “The following plug-in is unresponsive: Shockwave Flash”
No. 2 is a deja-vu of a similar issue in Firefox, the solution there is different though.
Pain with ArrayCollection addItemAt
Jun 29th
ArrayCollection has some nifty functionality, but it isn’t always a smooth sailing.
Gotcha 1: addItemAt doesn’t work if the ArrayCollection is sorted. Well, it does make sense, but there are situations when we could take advantage of the fact that sorting doesn’t happen before a refresh() call. Anyway, something that IMHO should be mentioned in the docs rather than only in ListCollectionView source: “if we’re sorted addItemAt is meaningless, just add to the end”.
Gotcha 2: Well, say, that we insist of using our collection, and so we try to remove the sorting to be able to do a meaningfull addItemAt. We set ac.sort=null; but instead of a great success, things explode on addItemAt. Well, the internal logic of ListCollectionView requires you to do a ac.refresh() after setting sort to null; if you don’t do that, it’s internal vars are out of whack and null references creep in. IMHO ArrayCollection should be smart enough to handle removal of sort without a subsequent refresh call.
Gotcha 3: Well, we call the ac.refresh() after setting ac.sort=null but now our item order is all screwed up. Epic phail. So, let’s just give up and copy the collection instead, shall we?
1 | var ac1:ArrayCollection = new ArrayCollection(ac0.toArray()); |
Simple example – Flash (AS3) and FormMail.cgi
May 29th
I’ve just created a little sample for a friend. He is a designer and “just needed something” that would allow him to capture the data that users enter. FormMail.cgi fits the bill – no need to touch any server files or databases, just point your Flash to a FormMail script that is already installed on your server and off you go – you are sending emails from Flash. It feels bit 90-ies, but it works.
What will you need:
- Flash CS3 or newer (download free 30 days trial from Adobe)
- URL to FormMail.cgi. Many hosting providers have installed FormMail.cgi for you – you will definitely have it if you have cPanel, look under Scripts to find the right path to yours. Otherwise ask your hosting provider or pinch somebody else’s FormMail (not recommended
).
Here are instructions that any Flash designer should be able to follow:
- Create a AS3 Flash document.
- Create your text inputs. My code is using 3 Text Inputs named: messageTI, nameTI, emailTI. You can create more, or rename them, but then you will have to add/modify the code a little bit.
- Create a button and name it sendB
- Create a dynamic text and name it statusTF
- Create an Actions layer and in the first frame put the following code, than modify the FormMail URL and recipient’s email:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | import flash.events.MouseEvent; import flash.profiler.showRedrawRegions; import flash.net.URLRequest; import flash.net.URLRequestMethod; sendB.addEventListener(MouseEvent.CLICK, sendData); function sendData(e:MouseEvent):void { if (messageTI.text.length > 3 && nameTI.text.length > 3 && emailTI.text.indexOf("@") > -1) { //very, very basic data validation (as this is not a data validation tutorial) var r:URLRequest = new URLRequest("http://YOUR-URL-TO-FORM-MAIL/FormMail.cgi"); //modify this URL var v:URLVariables = new URLVariables(); v.recipient = "YOUR-EMAIL@DOMAIN.com"; //put your email here v.subject = "My FormMail test"; //this will be the subject of the email v.email = emailTI.text; v.realname = nameTI.text; //user's name will be appended to his/hers email to form a From field of the email. v.theMessage = messageTI.text; //theMessage is a custom key. If you need more Input fields, just make up more custom fields like this one r.data = v; r.method = URLRequestMethod.POST; var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, completeHandler); try { loader.load(r); } catch (error:Error) { statusTF.text = "Unable to send data."; //we could definitely do more in terms of error handling, however this is not a error handling tutorial } } else { statusTF.text = "Please enter all required information."; } } function completeHandler(event:Event):void { statusTF.text = "Data submitted."; var loader:URLLoader = URLLoader(event.target); trace("completeHandler: " + loader.data); } |
Notes:
- You can place your components (Button, TextInputs & Dynamic Text) anywhere you like on a page, style them anyhow you like, but make sure they are in the first frame and have the correct names (case sensitive).
- If email is getting send but you are not receiving any – check your spam folder.
- You are too lazy to copy/paste? I hear you. Here is the sample flash file.
