Working with Adobe AIR FileSystem API on iPad

Recently I made some test on iPad to test how to update contents of my mobile applications.
I tried some new AIR 2 API like open default program with PDF or XLS files but I get error #3000 (privileges error).
My idea is to create a routine where I’ll be able to update all contents on my application without passing trough Apple store.
So I tried with URLStream and AIR filesystem API, everything works well.
Code is so easy, take a look here:

//RETRIEVING IMAGE FROM ANY WEBSERVER
var urlS:URLStream = new URLStream();
urlS.addEventListener(Event.COMPLETE, downloadComplete);
urlS.addEventListener(ProgressEvent.PROGRESS, showPerc);
urlS.load(new URLRequest("http://192.168.1.9:8888/oliviaWilde.jpg"))

//DOWNLOADED IMAGE BYTEARRAY AND LOADING IN LOADER
function downloadComplete(e:Event):void {

  perc_txt.text = "";
  fileData = new ByteArray();
  urlS.readBytes(fileData,0,urlS.bytesAvailable);
  bytes = urlS.bytesAvailable;
  l.loadBytes(fileData);
  l.addEventListener(MouseEvent.CLICK, saveIt);

}
//SAVE IMAGE INTO APPLICATIONSTORAGEDIRECTORY
function saveIt(e:MouseEvent):void{

  f = File.applicationStorageDirectory.resolvePath("a.jpg");
  var fs:FileStream = new FileStream();
  fs.open(f, FileMode.WRITE)
  fs.writeBytes(fileData);
  fs.close();

}

//LOAD IMAGE FROM APPLICATIONSTORAGEDIRECTORY 
function loadLocalImg(e:MouseEvent):void{

  var finalBA:ByteArray = new ByteArray();
  var fs:FileStream = new FileStream();
  fs.open(f, FileMode.READ);
  fs.readBytes(finalBA, 0, bytes);
  fs.close();
  l.loadBytes(finalBA);

}

Using applicationStorageDirectory, you can save data into your application and retrieve it with AIR API.
In the video below, you can see a little demo where I load an image from a server, I save it, I unload click on the black right button and finally I load again but from ApplicationStorageDirectory, with the black left one, instead of loading from webserver.

Advertisement

mPresenter, flash platform presentation tool

mPresenter is a new tool that my company develop in last few months, finally is available to download.
Going in deep about this new solution, what is it mPresenter?

mPresenter is a cross-platform software composed by 2 different tools: a mobile manager and a desktop viewer.
It helps you during own presentation to your boss or clients, during a public talk or only when you want to show your holidays photos to your friends.
With mPresenter you can manage your presentation directly from your mobile device, you can draw or highlight on a slide, photo or flash file, change with next or previous content, receive comments that you add in content and so on.

You can download AIR version on mPresenter official website and Android controller directly on Android Marketplace.In next few days (I hope) you can find mPresenter mobile on Apple store too, so stay tuned for news about it!

Do you want watch mPresenter in action? Take a look at youtube video.

Do you want to have a free copy?! It’s easy, go to official website, add mPresenter banner to your blog or website and the first 10 people that add a comments to this post with a link at own website with mPresenter banner automatically win a free mPresenter copy!
Remember to leave in the comment your name, email and link to the site where I can find mPresenter banner.

Finally, if you are going to MAX in L.A. and you want to know more about mPresenter, you can find me there, so feel free to drop me a line to meet there.

I’m waiting for feedbacks and have fun guys with mPresenter!

Think different?! NO… but maybe…

I want broken my silence about Apple vs Adobe “war” and share with you my thoughts.

It’s an hot topic and probably not all people will be agree with me but I feel to tell you my point of view.
First of all, today we are sure that Adobe will not invest anymore on iPhone packager for Flash CS5, so from a developer point of view I’m totally agree with Mike Chambers and Adobe too.
Android is a really amazing mobile OS not only for smartphone but also for MID, I saw on a Nvidia Tegra 2 and performance were really impressive.
I had an iPhone a year ago and now I’ve a HTC Hero with Android, guys believe me, it totally changes my life, everytime I say: “Android takes best features of Blackberry, iPhone and Nokia in one OS! Oh yes… phone calls work on Android :P”.

I saw AIR 2 and Flash Player 10.1 on Android in action during 3GSM in Barcelona and … WOW, Adobe is working very hard on that technologies and I test a Flash website not optimize for mobile on FP 10.1 and it works very well.
Future on Android will be very cool for every Flash Platform developers… but…

I’m also owner of a company and I know a little bit my customers or potential ones and if you talk about iPhone or Android they feel an app or game in different way.
I think the big problem is that few people known the powerful of Android OS and Google is not advertising so much it.
People that use Android after iPhone they don’t come back again, they are so happy about OS but if you take a look at carrier’s advertising they prepare great iPhone campaign but I didn’t see any Android campaign or carrier’s advertising dedicated to Android phones.
Adobe made a good job with iPhone packager and Apple close doors to it, if I see from point of view of both I could think that Adobe didn’t develop anything for iPhone and will not do that in the next future, Apple lose tons of possible applications in own store but they preserve their ecosystem, and freelances or IT companies?! Did you ever think to them?!

We are in a particular market moment where everybody is seeking a new way to make business or to invert the trend, those strategies could be useful in 80’s or 90’s not in 2010! Customers are not so happy to bring a company that make an iPhone app, another one for a RIA on web, another for a desktop apps and so on, or maybe one big company that make all but ask tons of money that there aren’t in this historical moment!
Lots of companies and developers were waiting for this new marketing possibility and probably, this possibility could create a win-win situation for everybody.
Companies and developers work more and have new possibilities to make business in a particular market moment, Adobe would be the first company that introduce in the market a technology that is real cross-platform, with AS3 I can develop on web, mobile, desktop apps and so on; probably many people upgrade to Flash CS5 only for iPhone packagers so they have a high ROI; finally Apple would have tons of new developers that will buy their products, probably approach Objective C maybe only to take a look but they will approach it, and they gain more revenue from the store… so everybody win nobody lose.
Probably it’s a poor point of view from a little man, but a win win situation could help in this moment…

I spent a couple of days to understand what is happening between Adobe and Apple but I think that nobody could know and nobody tell us the truth.
For now we can only wait and change our marketing strategy focusing on Android devices, maybe a day we could count more in big companies decisions… or maybe not…

MacWorld but also developer.apple.com

I love Apple so much!

This period is so interesting for MACWORLD and this year I’m so excite to view new iTV, new macbook AIR, new firmware upgrade for iPod Touch (finally I could see emails in my iPod Touch) and new services like rent video! That’s cool.

But also, I suggest to take a look at developer.apple.com, in particular in iPhone section, you must register for FREE and you’ll have a lots of materials about development on iPhone and so on.

There you can also submit your iPhone application and put in apple site. New opportunities ae growing up.
In 2008, I think that we’ll have a lots of changes from AIR to new Macbook AIR (everything we call AIR in 2008, it’s funny!).
I love Apple, I love AIR… and I love 2008!