I want to change the view states in my flex app when it resizes in the browser window.
I have the swf embedded at 100% x 100%. So when the user resizes the window below a certain width, I want to switch to a different state. I tried adding an event listener like this, but it only fires the event when I resize the swf outside the browser, not inside. I used:
this.addEventListener(ResizeEvent.RESIZE, SizeChanged);
I want this to work within the browser. I even tried using fixed dimensions in the embed code, instead of percentages, but that didn't help either.
R – Changing view states on application resize
actionscript-3apache-flexmxml
Best Answer
You want to add the listener to the stage.
Or you can add a listener via:
Also, keep in mind that this event fires a lot as the view is resizing, so you will want to account for that.