orientation trigger sizeChange

106 views
Skip to first unread message

carrot...@gmail.com

unread,
Apr 23, 2014, 6:02:42 AM4/23/14
to ormma-di...@googlegroups.com
Two questions:
1. how to trigger sizeChange() when orientation change?
the mraid api said:sizeChange was triggered by: change in the view size as the result of a resize, expand, close, orientation, or the app after registering a "size" event listener.
resize, expand, close ,these three methods are ok,orientation is unok
2. it is about getDefaultPosition issue
no matter how to change the size,orientation,the JSON {x, y, width, height} via getDefaultPosition is still the same,is that right?

Nathan Carver

unread,
Apr 23, 2014, 9:33:52 AM4/23/14
to ormma-di...@googlegroups.com
Hello,

For 1, the ad creative can not trigger a change, only listen for one. I would use mraid.addEventListener('sizeChange', foobar) first and then take actions like mraid.expand, mraid.resize or physically turn the device to a different orientation. All of these should make the SDK trigger your method foobar.

For 2, mraid.getDefaultPosition represents the geometry of the container when it is displaying the ad in "default" state. Therefore it should be consistent throughout the ad unit lifetime for a given orientation. But it should provide different values depending on the device orientation.

Thanks,
-Nathan



--
You received this message because you are subscribed to the Google Groups "ORMMA-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ormma-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

carrot...@gmail.com

unread,
Apr 29, 2014, 9:44:52 AM4/29/14
to ormma-di...@googlegroups.com
For 2,you mean that when orientation change the width and height will also change with this?
for example
on the default status,calling  getDefaultPosition () to get width and height (200x300),and then change the orientation from portrait to landscape,and calling getDefaultPosition again,the width and height is (300x200)?
the handle mechanism to getMaxSize and getSize is the same with getDefaultPosition ?


在 2014年4月23日星期三UTC+8下午9时33分52秒,Nathan写道:

Nathan Carver

unread,
Apr 29, 2014, 9:47:53 AM4/29/14
to ormma-di...@googlegroups.com
Yes, the values for all of the size methods should change when the device orientation changes. (Unless, of course, the device or container is square.)

Thanks,
-Nathan

Reply all
Reply to author
Forward
0 new messages