topical media & game development
#iv-vip.mx
#iv-vip.mx
[swf]
[flash]
flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:iv="*" layout="absolute"
creationComplete="init()" width="870" height="710"
paddingLeft="0" paddingTop="0" paddingBottom="0" paddingRight="0" backgroundColor="#000000">
<mx:Style source="/Style/obsidian.css"/>
<mx:String id="dispState" />
<mx:Script>
<![CDATA[
import mx.events.*;
import flash.display.Sprite;
import flash.events.MouseEvent;
import mx.managers.SystemManager;
import InteractiveVideoAS.InteractiveVideoEvent;
import flash.display.StageDisplayState;
import mx.managers.SystemManager;
public var config:String = "iv-vip";
private var state:int = 0;
private var sprite:Sprite;
private function hush():void {
//sprite = new animation_ch04_DrawingApp();
/* Set up full screen handler. */
systemManager.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
dispState = systemManager.stage.displayState;
}
private function fullScreenHandler(evt:FullScreenEvent):void {
dispState = systemManager.stage.displayState + " (fullScreen=" + evt.fullScreen.toString() + ")";
if (evt.fullScreen) {
/* Do something specific here if we switched to full screen mode. */
} else {
/* Do something specific here if we switched to normal mode. */
}
}
private function toggleFullScreen():void {
try {
switch (systemManager.stage.displayState) {
case StageDisplayState.FULL_SCREEN:
/* If already in full screen mode, switch to normal mode. */
systemManager.stage.displayState = StageDisplayState.NORMAL;
break;
default:
/* If not in full screen mode, switch to full screen mode. */
systemManager.stage.displayState = StageDisplayState.FULL_SCREEN;
break;
}
} catch (err:SecurityError) {
// ignore
}
}
private function zhHandler ( event:MouseEvent ):void
{
if (state == 0) {
//myLabel.text = " XXXXXXXXXXXXXXX ";
//videoLabel.text = " XXXXXXXXXXXXXXX ";
textLabel.text = " 还是笑? ";
text1Label.text = " (气候变化) ";
state = 1;
} else if (state == 1) {
//myLabel.text = " game over ";
textLabel.text = " 你们会笑,从现在起20年内? ";
text1Label.text = " (气候变化) ";
state = 2;
} else if (state == 2) {
//myLabel.text = " game over ";
textLabel.text = " game over ";
text1Label.text = " (算你的祝福) ";
state = 3;
} else {
textLabel.text = " ";
text1Label.text = " ";
state = 0;
IVViewStack.stage.removeChild(sprite);
}
}
private function enHandler ( event:MouseEvent ):void
{
if (state == 0) {
//myLabel.text = " XXXXXXXXXXXXXXX ";
//videoLabel.text = " XXXXXXXXXXXXXXX ";
textLabel.text = " still laughing? ";
text1Label.text = " (the climate is changing) ";
state = 1;
} else if (state == 1) {
//myLabel.text = " game over ";
textLabel.text = " and 20 years from now? ";
text1Label.text = " (the climate is changing) ";
state = 2;
} else if (state == 2) {
//myLabel.text = " game over ";
textLabel.text = " game over ";
text1Label.text = " (count your blessings) ";
state = 3;
} else {
textLabel.text = " ";
text1Label.text = " ";
state = 0;
}
}
private function init():void {
hush();
//myIVPlayer.addEventListener(FlexEvent.HIDE,onVideoPlayerHidden);
//myIVPlayer.configService.url = "iv-config-climate.xml";
myIVPlayer.configService.url = config + ".xml";
myIVPlayer.init();
myIVPlayer.addEventListener(InteractiveVideoEvent.COMPLETE, onVideoPlayerHidden);
systemManager.stage.scaleMode = "showAll";//"exactFit";
systemManager.stage.align = "top";
}
private function goToTitleScreen():void {
sprite = new animation_ch03_Oval();
//sprite = new animation_ch09_Bubbles2();
IVViewStack.stage.addChild(sprite);
IVViewStack.selectedChild = titleScreen;
}
private function goToMenuScreen():void {
IVViewStack.selectedChild = menuScreen;
}
private function goToVideoScreen():void {
if(myIVPlayer.startInteractiveVideo()) {
IVViewStack.selectedChild = videoScreen;
}
else {
goToEvaluationScreen();
}
}
private function onVideoPlayerHidden(event:InteractiveVideoEvent):void {
goToEvaluationScreen();
}
private function goToEvaluationScreen():void {
gameScoreLabel.text = myIVPlayer.getGameScore();
subjectTrace.dataProvider = myIVPlayer.outputPlayedSubjects();
IVViewStack.selectedChild = evaluationScreen;
}
private function titletext():String {
return "ViP" + " - " + config;
}
]]>
</mx:Script>
<mx:ViewStack id="IVViewStack" width="100%" height="100%" selectedIndex="0" creationPolicy="all" alpha=".9">
<mx:TitleWindow id="titleScreen" horizontalAlign="center">
<!--
<mx:Text text=titletext("Video interactive Presentation") fontSize="24" width="90%" textAlign="center"/>
-->
<mx:Text text="{titletext()}" fontSize="24" width="90%" textAlign="center"/>
<!--<mx:VideoDisplay id="titleScreenVideo" autoPlay="true" complete="titleScreenVideo.play()"
width="320" height="240" source="MovingEarth.flv"/>-->
<mx:Text text="V44/AE © 2007-2008 Eliëns, Huurdeman, Bhikharie, van de Watering" width="90%"
textAlign="center"/>
<mx:Image source="@Embed('@logo.jpg')" width="640" height="480" click="goToVideoScreen()"/>
<mx:Button label=">>" click="goToMenuScreen()" cornerRadius="0"/>
</mx:TitleWindow>
<mx:TitleWindow id="menuScreen" title="Video interactive Presentation" horizontalAlign="left">
<mx:Text fontSize="18" width="90%" selectable="false">
<mx:htmlText>
<![CDATA[
<ul>
<li>explore -- watch the video</li>
<li>play -- make choices by clicking in the video</li>
<li>challenge -- find hidden segments to score bonus points</li>
<li>learn -- answer extra question correctly for more bonus points</li>
</ul>
]]>
</mx:htmlText>
</mx:Text>
<mx:Button label=">>" click="goToVideoScreen()" cornerRadius="0"/>
</mx:TitleWindow>
<mx:TitleWindow id="videoScreen" horizontalAlign="center">
<iv:InteractiveVideoPlayer id="myIVPlayer"/>
</mx:TitleWindow>
<mx:TitleWindow id="evaluationScreen" title="Your storyline" horizontalAlign="center"
backgroundAlpha="0.0">
<mx:HBox>
<mx:Label text="Your score: " fontSize="18"/>
<mx:Label id="gameScoreLabel" text="0" fontSize="18"/>
</mx:HBox>
<mx:Label text="Played subjects:" top="10" fontSize="18"/>
<mx:List id="subjectTrace" dataProvider="{subjectTrace}" color="#FFFFFF" textAlign="center"
fontSize="14" selectable="false" rowCount="21" backgroundAlpha="0.0" borderStyle="none"
width="100%"/>
</mx:TitleWindow>
</mx:ViewStack>
<mx:Label id="textLabel" text="" color="#ffffff" x="80" y="200" fontSize="40" />
<mx:Label id="text1Label" text="" color="#ffffff" x="80" y="500" fontSize="30" />
<mx:HBox horizontalAlign="center" verticalAlign="top" width="100%" height="20">
<mx:Button label="zh" click="zhHandler(event);" cornerRadius="0" />
<mx:Button label="en" click="enHandler(event);" cornerRadius="0" />
<mx:Button label=">>" click="goToTitleScreen()" cornerRadius="0"/>
<mx:Button label="f/v" click="toggleFullScreen()" cornerRadius="0" />
</mx:HBox>
</mx:Application>
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.