0

I am working in flash CS5.5 on an app for iOS. I want to get the ipad/iphone to stop animating the orientationChange and just change it directly, is this possible?

I thought this was a solution but it didnt help AS3 - iOS force landscape mode only?.

Community
  • 1
  • 1

2 Answers2

3

If you try setting Stage.autoOrients = false;, the flash.events.StageOrientationEvent.ORIENTATION_CHANGE will never fire. That's helpful for disabling orientation changes altogether, but not for your issue. While I haven't tried it myself, you may be able to listen to the event:

flash.events.StageOrientationEvent.ORIENTATION_CHANGING

You may be able to call event.preventDefault() in that listener to stop the actual rotation from occuring. Then you can manually set it yourself:

Stage.setOrientation(StageOrientation.ROTATED_RIGHT);
James Tomasino
  • 3,520
  • 1
  • 20
  • 38
  • Thank you so much for your answer and sorry for my late (my flash went nuts). I've tried this before and know i did it again with the same result... Haven't found any other solution so i will have to do it the boring way, put it all in a container and handle everthing myself... – Eric Jacobsson Nov 25 '11 at 21:12
  • 2
    @EricJacobsson So then, you didn't mention you trying the "boring way" already, and JamesTomasino correctly answered your question. Also, you didn't mention in your question you also need to have fun with event listeners, maybe he could have added some comments to spice things up. – oxygen Oct 07 '12 at 19:37
2

have you tried the SO answer: Disable orienation change rotation animation ?

the code from that answer that goes in the view-controller that is the home for your flash CS5.5 or air 3.5 is:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    [UIView setAnimationsEnabled:YES];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    [UIView setAnimationsEnabled:NO];

    return TRUE;  /* Your original orientation booleans, in case you prevent one of the orientations */
}

that code makes use of native iOS UIViewController functions that can be overridden. you would have to have a native iOS objective C class that overrides UIViewController, and then you could insert the code above. calls are made when the device is rotated to these as part of view controller life cycle.

Community
  • 1
  • 1
john.k.doe
  • 7,533
  • 2
  • 37
  • 64
  • I don't relaly know how to use this code, do I have to write a Native Extension specifically for it? – Maurycy Oct 12 '12 at 06:28
  • i've edited the answer to describe where those calls reside. unfortunately, i can help no further with advice as to whether there is API at the scripting level that will give access to these at the point of your event for a stage orientation change. but if it is there, handlers for events for pre- and post-rotation would have to be written to match. and then the problem is whether or not there is scripting access to turn on and off whether animations are enabled, and since these are class methods, it would be a special kind of scripting access. – john.k.doe Oct 12 '12 at 08:14