Skip to main content
Inspiring
August 8, 2011
Question

MediaEvent (accessing photos in Camera Roll)

  • August 8, 2011
  • 3 replies
  • 1167 views

I have Flash CS5, Adobe Air 2.7, I got everything installed, I can make apps and run them on my iPhone (developer, payed the money to Apple).

I've done alot of stuff now and wanted to continue learning so I was looking into the Camera Roll and I now need to use MediaEvent, but for some reason all examples I've found on the internet throws the same error:

1046: Type was not found or was not a compile-time constant: MediaEvent.

Why is this?

All the words in the text panel of Flash is blue, except MediaEvent which is grey (import flash.events.MediaEvent)

Two more that are grey and doesn't work are:CameraUI and MediaType.

What I want to do is to open a photo from the Camera Roll, but they all need MediaEvent which doesn't work for some reason.

Stuff like this works: (code to save the screen as an image in the Camera Roll)

if (CameraRoll.supportsAddBitmapData)

{
    var cameraRoll:CameraRoll = new CameraRoll();
    cameraRoll.addEventListener(ErrorEvent.ERROR, onCrError);
    cameraRoll.addEventListener(Event.COMPLETE, onCrComplete);
    var bitmapData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
    bitmapData.draw(stage);
    cameraRoll.addBitmapData(bitmapData);
}
else
{
    trace("not supported.");
}

function onCrError(event:ErrorEvent):void

{
    // Notify user.
}

function onCrComplete(event:Event):void

{
    // Notify user.
}

I find so many examples of how to browse the photos in the Camera Roll, but for some reason none works for me, error messages and grey words, and they should only need AIR 2.5.

This topic has been closed for replies.

3 replies

relaxatraja
Inspiring
August 11, 2011

cross verify the screenshot, you need AIR 2.5

TenchyMyoAuthor
Inspiring
August 13, 2011

I solved it by reinstalling everything

relaxatraja
Inspiring
August 13, 2011

Great

Pahup
Adobe Employee
Adobe Employee
August 11, 2011

If error about MediaEvent is a compile time error, then definitly your application is using SDK less than 2.5

Also, what's the namespace you're using in your application descriptor?

To use browseForImage, It should be 2.6 or greater for iOS

-Pahup

Inspiring
August 10, 2011

Are you sure your app use AIR 2.7? In older version of AIR for iOS, the only available method for the camera was CameraRoll.addBitmapData...