How to switch from Actionscript 2 to Actionscript 3… in September for FREE in Milan and Rome

During September I’ll take part of Arrivano i Guru Tour, an Italian event that allow designers, developers and photographers to learn new stuff for FREE about Adobe technologies!
In fact, the event starts in September until to the end of October and you can see it in 10 differents Italian cities.

In the last event you can find a special guest… Katrine Eismann, on of the most important person in creative digital retouch world!
I decide to talk about a big problem for a lot of developers: How to switch from Actionscript 2 to Actionscript 3 during my sessions in Milan (27th September) and Rome (5ht September).

During my session we can see the power of new AS3 features,  architecture of new Flash Player and differences of both languages.
You can see a real mirror from AS2 scripts to AS3 scripts and how to porting your daily “Actionscript life” to a new step: more interesting and powerful!

If you’d like to have more information take a look at the site or feel free to contact me leaving a message on my blog or dropping me an email.

I hope to see you during this event and remember that is a great opportunity to learn more and for FREE!

See ya!

Advertisements

Create PDF in runtime with Actionscript 3 (AlivePDF, Zinc or AIR, Flex or Flash)

This morning I’ve a new target, create PDF in runtime with Actionscript 3.
Very cool project to accomplished this mission is AlivePDF, an opensource AS3 library that you can download from Google Code.
AlivePDF allow you to generate PDF in runtime with Actionscript 3 and you can add pages, draw in each pages or add images, it’s very powerful library.

In this sample I use Actionscript 3 (with FDT) and Multidmedia Zinc 3, but you can use Flex or Flash and AIR to make this sample.
So first of all I create a simple class that allow you to create a PDF file with multiple pages and to add content in each pages.
This is the code:

package org.mart3.pdfGeneration {
    import flash.events.Event;    
    import flash.utils.ByteArray;    
    
    import org.alivepdf.images.ImageFormat;    
    import org.alivepdf.saving.Method;    
    
    import flash.display.Loader;    
    import flash.events.IEventDispatcher;    
    import flash.events.EventDispatcher;
    
    import org.alivepdf.pdf.PDF;
    import org.alivepdf.layout.Orientation;
    import org.alivepdf.layout.Size;
    import org.alivepdf.layout.Unit;
    import org.alivepdf.display.Display;
    
    /**
     * @author lm
     */
    public class CreatePDF extends EventDispatcher {
        
        private var pdf:PDF;
        public var pdfBA:ByteArray;
        
        public function CreatePDF(target : IEventDispatcher = null) {
            super(target);
            
            pdf = new PDF(Orientation.LANDSCAPE, Unit.MM, Size.A4);
            pdf.setDisplayMode(Display.FULL_PAGE);
        }
        
        public function set totalPages(num:int):void{
                
            for(var i:int = 0; i < num; i++){
            
                pdf.addPage();    
                
            }
    
        }
         public function setData(_l : Loader, _numPage:int) : void {
            
            pdf.gotoPage(_numPage);
            pdf.addImage(_l, 15, 15, 0, 0, ImageFormat.JPG, 100);
        }
        
        public function savePDF():void{
            pdfBA = new ByteArray();
            pdfBA = pdf.save(Method.LOCAL);
            
            var evt : Event = new Event("baReadyEvent");
            dispatchEvent(evt);
        }
    }
}

Obviously if you want, you can create a custom event that pass to the document class the ByteArray but this is a quick sample to show how you can create PDF in runtime!

One of the amazing things that you should do with AlivePDF, it’s that you can decide to save PDF locally or on web! Read documentation because it’s very interesting what you can do with this library!

Ok now, go to document class where we use MDM swc that you can find when install Zinc on your computer (you can find 2 differents SWC, one for Flash and the other one for Flex. Remeber also that Flash SWC works with Flash CS4 also, not only with Flash CS3!).
In this class we do those simple steps:

  • create a PDF object using CreatePDF object
  • set our PDF document
  • pass an external image loaded with Loader object
  • save PDF bytearray with Zinc FileSystem class
package org.mart3.pdfGeneration {

    import flash.display.MovieClip;    
    import flash.net.URLRequest;    
    import flash.display.Loader;    
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;

    import mdm.*;

    import org.mart3.pdfGeneration.*;

    /**
     * @author lm
     */
    public class Main extends Sprite {
    
        private var pdfObj:CreatePDF;
        private var l : Loader;
    
        public function Main() {
            
            mdm.Application.init(this);            
            
            pdfObj = new CreatePDF();
            pdfObj.totalPages = 2;
            pdfObj.addEventListener("baReadyEvent", saveLocalPDF);
            
            l =  new Loader();
            l.name = "myImg";
            
            l.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);
            l.load(new URLRequest(mdm.Application.path+"assets/bg.jpg"));
        }
        
        private function saveLocalPDF(e:Event) : void {
        
            mdm.FileSystem.BinaryFile.setDataBA(pdfObj.pdfBA);
            mdm.FileSystem.BinaryFile.writeDataBA(mdm.System.Paths.desktop+"generate.pdf");
    
        }

        private function showImage(event : Event) : void {
            
            l.scaleX = l.scaleY = .4;
            var mc : MovieClip = new MovieClip();
            mc.buttonMode = true;
            mc.addEventListener(MouseEvent.CLICK, savePDF);
            mc.addChild(l);
            this.addChild(mc);
        }
        
        private function savePDF(event : MouseEvent) : void {
            event.currentTarget.alpha = .5;
            pdfObj.setData(l, 1);
            pdfObj.savePDF();

            
        }
    }
}

You can also download source files from their hosting service and test it on your computer.
Feel free to give me any comments about AlivePDF, it’s very interesting to know what you think about this AS3 library.

First images of Zinc 3.0

Zinc 3.0 codename Pandora will be release at Q1 of 2008, but now you can see first images for Macintosh and Windows directly from Jaspal Sohal blog.  You can also try to enter in Candidate BETA program if you are registered in multidmedia.comIn fact they said:“The Public Beta will be a Release Candidate Build with all functionality that will be in the final release. Registered Users will have an opportunity to download the Public Beta and test it over the Holiday period. The Zinc™ 3.0 Public Beta will be available for both Windows and Mac OSX.”

Flash Lite 3 & Zinc 3.0, new softwares released this weekend

This weekend Adobe announced that is ready new flash lite version developer edition, dowloadable for free from labs.adobe.com.
Remember that you can develop flash lite 3 contents only if you upgrade Flash CS3 and Device Central.
More information about features and files to download you can see at Bill Perry’s blog.
If you test this developer release in your device, remember to write in Flash Lite 3 Forum which device you are using!

You can also see Flash Lite 3 application in action from Biskero’s blog, very cool video!

Finally multidmedia announce Pandora project that is new Zinc version with new big features and optimization.
New features are (from Pandora’s devlab):

. Mac OSX Output will now be in Native Universal Binary and optimized for Mac 10.5 “Leopard”
. Windows Projectors will have been specifically optimized for Vista
. Windows & Mac OSX Projectors almost 500% faster than Zinc 2.5 Projectors
. The entire {mdm}Script API will now be 100% Modularized
. Dynamic Form Creation
. An extensive Custom Command SDK will be available for both Windows and Mac OSX Developers
. {mdm}Script 3.0 – Completely re-written from scratch and now Unicode (UTF8/UTF16) Compliant
. {mdm}Script 3.0 – Greater Similarity between Windows & Mac OSX Classes
. Completely New GUI on Windows & Mac OSX – Screenshots available in December 2007!
. Several other “Industry Firsts” to be revealed in December 2007!

Probably Zinc 3.0 will go out in January 2008 but a public BETA will be release in December.
So take a look at Multidmedia site!

Touch screen and cd-rom with Multidmedia Zinc

One recent project that I produce is a touch screen software, obviusly I made it with Zinc.

So I’d like to share my experience with my blog readers.

First of all, I must say that Zinc has a too bad documentation, a lots of examples don’t work and there are some big bugs.

ZINC and FTP CONNECTION
In my last project I add a routine to download new files from touch screens.
Zinc FTP API works only in Windows, but for this project, all touch screens had OS Win, so no problem.
In this case, I found 3 problems, first of all I can’t download all files togheter because Zinc had some issues to do this operation, so when I download a file, when onComplete event triggered I launch another one.
Probably Zinc didn’t copy all bytes from FTP server to client and it crashed.
So I put a setTimeOut function to call a new file after 1 second and it works!
Finally, using close method of FTP class, FTP session is still opened…so I delete FTP istance and it works! So crazy!

ZINC and Flex
Recently I produce 3 projects with Flex and Zinc…I found a lots of interesting issues.
When you work with Zinc in Flex, you must add SWC library to use Zinc API, so you bring it from 2 folders(one .swc in for Flash and one for Flex, but you could use both in Flex) and there is different way to implements same API with .swc for Flash or for Flex, so take a look of which .swc you could use to work.
Another problem that I found is when you create a transparent application and you have mx:TextInput, if you have focus in textinput component and you try to use keyboard arrows to move cursor, you’ll receive an unknown error!
In Multidmedia forum Peter suggests to me to use callLater function, but it doesn’t work.

So those are some problems that I would share with you, I hope that they are useful for everyone.

FotB, the second day

Second day at FotB was better than first!
If English people said: “God save the Queen”, I say: “God save Mario Klingemann“… he is a big geek and a showman!
You can find Mario’s preso directly in quasimondo.com (his blog), so Mario show us how to use BitmapData class and create very cool effect. It was an amazing session and it registered SOLD OUT.

Another big preso was Ted Patrick‘s session where he explain us the worst practice to use Flex! Ted is a big speaker, in few slides he show us what we could do to create solid and good projects, very interesting.

So now I’m starting the last day here… talking with Mr. Davey, that organizes FotB, he said me that next year FotB probably starts in the end of September, so take a space in your agenda and come in Brighton!

First day at FOTB

First day at FOTB was fantastic, speakers prepared great session, in particular inspire sessions are crazy!!!
Joshua Davis is an amazing speaker so cool presentation!

But another amazing thing is after the first inspire session where out of Pavillion Theatre the guys of Plug-in Media create a flash installation where you can interact with and when you move yourself starts from some areas one or more fireworks, very crazy!

After this we came to Brighton Casino and we gambled and eat all night!

When I’ll come back in Italy, I’ll create a Flickr account and put in all FOTB and Chicago MAX photos there.

And now I’ll start a new FOTB day! What amazing event!