Thursday, July 14, 2011

Google Earth Plugin Works in Firefox but not IE

A nice 3 hours wasted of my life. I have a Flash app that has a Google Earth Plugin overlay on it. I upgraded to Internet Explorer 9 and the globe would not appear (only in FF and Chrome). It would just be a blank screen and sometimes for 1 second I could see the plugin spinner for 1 second.

I finally came across an IE doc that specified everything needs to be HTML5 compliant.

The problem was quickly fixed. I had my top tag as "<html>". Changing it to "<!doctype html>" fixed everything. Thanks for nothing IE.

Monday, April 11, 2011

"No Templates Proposals" Warning Error in Flash Builder

When hitting the Ctrl + SPACE bar I no longer receive my attributes or any of the code assist helping I got before. It turns out it actually is still there....hold the CTRL + hit the SPACEBAR two plus times.

I'm not sure why editing my Templates in Preferences now make it the default one of the cycle to show when doing a code edit, but so it goes.

Tuesday, February 01, 2011

XCode Build and Archive menu disabled - grayed out

Man, I spent an inordinate amount of time on this. The drop-down combo box at the very top left of XCode where you specify the iOS version and SDK...it's on Simulator. Change it to "Device."

Hopefully this helps someone. RTFM also helped for me.

Wednesday, November 24, 2010

Upload Image from Camera in Mobile Adobe AIR Android

For some reason I really struggled to upload a File (bytes) that I had in memory. It's easy to upload with the FileReference class, but that has an order of what methods can be called dependent on the browse() method being called. In this case, I have an Android <s:MobileApplication> app that uses the CameraUI class to take a picture and upload.

The key is taking the File that is returned, reading the bytes, and using a 3rd party library called MultipartURLLoader (which URLLoader can't do) to upload it.


private var myCam:CameraUI;
private var pictureFromCamera:File;
private var myByteArray:ByteArray;



/** This method you're used to seeing. The handler for when a user takes a picture */
protected function creationCompleteHandler(event:FlexEvent):void
{
      if (CameraUI.isSupported)
{
myCam = new CameraUI();
myCam.addEventListener(MediaEvent.COMPLETE, onPictureTakenComplete, false, 0, true);
}
}


/**
 * Handler for when user closes camera with a picture. MediaEvent (AIR only).
 */
private function onPictureTakenComplete(evt:MediaEvent):void
{
myByteArray = new ByteArray();
pictureFromCamera = evt.data.file;
//load file into bytes
var myFileStream:FileStream = new FileStream();
myFileStream.open(pictureFromCamera, FileMode.READ);
myFileStream.readBytes(myByteArray);
 myFileStream.close();
}


/** method that uploads to server using a 3rd party lib */
public function upload_clickHandler(e:Event):void
{

var ml:MultipartURLLoader = new MultipartURLLoader();
ml.addEventListener(Event.COMPLETE, onUploadComplete, false, 0, true);
//add variables
ml.addVariable('title', titleField.text);
//add file bytes
ml.addFile(myByteArray, pictureFromCamera.name, 'file');
//submit
ml.load('http://justinbieberistheworst.com/upload.do');
}

Monday, November 22, 2010

Alfresco Flex AIR Upload File Basic Authentication Error

See the wiki page for the Alfresco Upload Webscripts, but with these files, I was unable to upload files without always getting the Basic Authentication popup window always appearing. The key was adding the 'alf_ticket' request parameter to the URL string:

fileRef = new FileReference(); //instantiated earlier

urlVars = new URLVariables();
urlVars.title = 'my title';
urlVars.desc = 'my description';

urlReq = new URLRequest();
urlReq.method = URLRequestMethod.POST;
urlReq.data = urlVars;
//ticket was returned after logging in
urlReq.url = "http://<<myserver>>/alfresco/service/site/upload?alf_ticket="+this.ticket;
//
fileRef.upload(urlReq, 'file');

Login code...

var svc : HTTPService = new HTTPService();
svc.resultFormat = 'e4x'
svc.addEventListener(ResultEvent.RESULT, onLogin);
svc.url = "http://<<myserver>>/alfresco/service/api/login";
var params : Object = {};
params.u = 'bsmith';
params.pw = 'password';
svc.send(params);


  protected function onLogin(event:ResultEvent):void
  {
     this.ticket = XML(event.result).text().toString();
  }

Tuesday, October 19, 2010

A Simple JQuery Mobile RSS Example

With the jquery mobile framework in alpha release, I took it for a spin drive. I hadn't worked a lot with jquery much at all prior to this so it was a good learning experience all around. A couple gotchas I had learned the hard (timely way).

1.) The jquery $.get() and $.ajax() methods cannot load rss feeds from other websites. You have to use a proxy, or download the rss file and access it locally.

2.) Just because you have that rss xml file saved in the same directory as your html file doesn't mean squat. Again, you'll have to load your files onto a server like tomcat and test that way.

Here's the completed example. It loads a RSS file and creates a jquery mobile list. VERY few lines of code, which is why jquery rocks so well. Amazing for API calls, parsing, and accessing the html DOM.

Click to view source from there: http://vandalaysolutions.com/sva/sample2.html

Note, there is a bug in the framework with the <ul> not refreshing after I append (add)  a new <li> item...so after looping through and adding all the RSS items, I manually refresh the <ul> calling listview on line 26:

list.listview();

If you're new to JQuery, check out this post. It explains why/how the "$" signs are OK as Javascript declarations and some great examples of useful DOM transversing.

Monday, April 12, 2010

ArgumentError: Error #1063: Argument count mismatch on mx.core::CrossDomainRSLItem(). Expected 5, got 7.
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1878]
at mx.managers::SystemManager/initHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2419]

This was an easy one to fix. Your main app is compiling with a different Flex SDK than one of your modules (RSL). Check each module Flex Project Compiler properties and make sure they're all on the same sdk.