Archive for April, 2009

Using Visual State Groups

Visual State GroupsJust started using Visual State Groups.  They provide a great way to merge animations of different types.  In this example I have an animation that drops the content of a user control in from the top called ‘Show’ and another one that pulls it back up again when the user is finished with it called ‘Hide’.

However the user control also needs to slide in from the left into four different positions depending on what’s called it.  Without Visual State Groups I would have to add my up/down animations to each left/right animation.

By splitting them up – making sure no animation conflicts – I can run a ‘Show’ animation with any of my five left/right animations.

Awesome

PS. This later caused me problems as I wanted to play one animation from one Visual State Group before the other.  This could only be solved by getting rid of the groups and just changing the left/right alignment programatically.  Still Visual State Groups can have alsorts of advantages even if they weren’t appropriate here.

Problems with Flash, Video, Projectors and Full Screen

Sometimes things just don’t work. Flash CS4 (AS3) seems to have a problems when you have a combination of video (FLVPlayback) in a projector that is set to appear full screen.

Here’s the best way to dodge the proplems.

  • Keep the video on the main timeline.
  • Set fullScreenTakeOver to false to stop the video becoming full screen when the projector does.
  • When hiding the video also set the FLVPlayback skin to nothing. Without this there is an intamitant bug that will make the skin not move with the player.

The full screen code.

mainVideoPlayer.visible = false;
mainVideoPlayer.fullScreenTakeOver = false;

stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.NO_SCALE;

Hiding the video

mainVideoPlayer.skin = "";
mainVideoPlayer.x = -2000;

Showing the video

mainVideoPlayer.skin = "SkinUnderPlayStopSeekCaptionVol.swf";
mainVideoPlayer.x = _originalVideoX;