0

I have an Air/As3 app with a stage size of 1024x600 px auto scaled to fit a screen of 1280x720 px. When I request an admob ad (using an ANE) the ad width size reported is 320 (Standard Banner) but this size is based on DPI not in real pixel and I can not calculate x position to get it aligned to center of the screen. How can I get the real pixel width size of the ad?

Delcasda
  • 371
  • 4
  • 13
  • I see admob first time good thing though.. I don't understand you did not get it as Flash DipslayObject? – ggat Apr 01 '13 at 15:51

1 Answers1

1

The conversion from dp units to screen pixels is given by

px = dp * (dpi / 160)

as explained here

http://developer.android.com/guide/practices/screens_support.html

so does not matter if you are scaling the flash content as the admob ad does not care. To center the ad at the bottom of the screen you use this:

    admob.addToStage((Capabilities.screenResolutionX/2)-(((admob.getAdSize().width)*(Capabilities.screenDPI/160))/2),(Capabilities.screenResolutionY)-((admob.getAdSize().height)*(Capabilities.screenDPI/160)));
Delcasda
  • 371
  • 4
  • 13