Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicker Leung authored and Vicker Leung committed Feb 19, 2014
0 parents commit 8abd86c
Show file tree
Hide file tree
Showing 16 changed files with 961 additions and 0 deletions.
38 changes: 38 additions & 0 deletions flex-faq-001/src/flex_faq_001.mxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="{this.t_ti.setFocus ();}">

<mx:Style source="style/style.css" />

<mx:Panel
horizontalCenter="0" verticalCenter="0"
title="Flex FAQ #1: Setting default TextInput">

<mx:Label text="這個是目標 TextInput 元件:" />
<mx:Label text="This is the target TextInput component:" />

<mx:TextInput id="t_ti" width="100%" />

<mx:Spacer height="20" />

<mx:LinkButton
label="解釋. Explanation."
click="{navigateToURL (new URLRequest ('http://vicker.cubeforge.net/blog/2007/08/04/flex-faq-1-how-to-place-flex-applications-input-cursor-focus-on-a-specific-textinput-control-by-defaul/'));}" />

</mx:Panel>

<mx:LinkButton
top="10" left="10"
label="Fork me on GitHub"
click="{navigateToURL (new URLRequest ('https://github.com/Vicker/flex-faq-001'));}"
/>

<mx:LinkButton
bottom="10" right="10"
label="Vicker's Coding Kitchen 2007. Creative Commons License."
click="{navigateToURL (new URLRequest ('http://vicker.cubeforge.net/blog'));}"
/>

</mx:Application>
23 changes: 23 additions & 0 deletions flex-faq-001/src/style/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Application
{
backgroundGradientColors: #333333, #000000;
color: #FFFFFF;
}

Panel
{
paddingTop: 10;
paddingBottom: 10;
paddingLeft: 10;
paddingRight: 10;
}

Label
{
color: #333333;
}

TextInput
{
color: #333333;
}
Binary file added flex-faq-003/src/assets/flaber.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions flex-faq-003/src/flex_faq_003.mxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
>

<mx:Style source="style/style.css" />

<mx:Script>
<![CDATA[
private var _file_ref:FileReference;
public function cant_download (e:MouseEvent):void
{
var t_file_ref:FileReference = new FileReference (); // this is the main concern - function variable
var t_url_request:URLRequest = new URLRequest ("assets/flaber.png");
t_file_ref.download (t_url_request);
}
public function can_download (e:MouseEvent):void
{
this._file_ref = new FileReference (); // this is the main concern - class variable
var t_url_request:URLRequest = new URLRequest ("assets/flaber.png");
this._file_ref.download (t_url_request);
}
]]>
</mx:Script>

<mx:Panel
horizontalCenter="0" verticalCenter="0"
title="Flex FAQ #3: Downloading a file using FileReference">

<mx:HBox>

<mx:VBox height="100%" horizontalAlign="center" verticalAlign="middle">
<mx:Image source="assets/flaber.png" />
<mx:Label text="assets/flaber.png" />
</mx:VBox>

<mx:Spacer width="20" />

<mx:VBox height="100%" verticalAlign="middle">
<mx:Button label="這個不能下載" click="{this.cant_download (event)}" />
<mx:Button label="This is not downloadable" click="{this.cant_download (event)}" />

<mx:Spacer height="20" />

<mx:Button label="這個可以下載" click="{this.can_download (event)}" />
<mx:Button label="This is downloadable" click="{this.can_download (event)}" />
</mx:VBox>

</mx:HBox>

</mx:Panel>

<mx:Label
top="10" left="10"
text="Fork me on Github"
color="#FFFFFF"
click="{navigateToURL (new URLRequest ('https://github.com/Vicker/flex-faq-003'));}"
/>

<mx:LinkButton
bottom="10" right="10"
label="Vicker's Coding Kitchen 2007. Creative Commons License."
click="{navigateToURL (new URLRequest ('http://vicker.cubeforge.net/blog'));}" />

</mx:Application>
28 changes: 28 additions & 0 deletions flex-faq-003/src/style/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Application
{
backgroundGradientColors: #333333, #000000;
color: #FFFFFF;
}

Panel
{
paddingTop: 10;
paddingBottom: 10;
paddingLeft: 10;
paddingRight: 10;
}

Label
{
color: #333333;
}

TextInput
{
color: #333333;
}

Button
{
color: #333333;
}
117 changes: 117 additions & 0 deletions flex-faq-005/html-template/index.template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!-- saved from url=(0014)about:internet -->
<html lang="en">

<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${title}</title>
<script src="AC_OETags.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = ${version_major};
// Minor version of Flash required
var requiredMinorVersion = ${version_minor};
// Minor version of Flash required
var requiredRevision = ${version_revision};
// -----------------------------------------------------------------------------
// -->
</script>
</head>

<body scroll="no">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);


// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
if ( hasProductInstall && !hasRequestedVersion ) {
// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;

AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"allowFullScreen","true",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="${application}" width="${width}" height="${height}"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
width="${width}" height="${height}" name="${application}" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
allowFullScreen="true"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
</html>
100 changes: 100 additions & 0 deletions flex-faq-005/src/flex_faq_005.mxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="{this.h_creation_complete (event)}"
>

<mx:Style source="style/style.css" />

<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.collections.ArrayCollection;
import net.cubeforge.utils.StringUtil;
[Bindable] public var _ac:ArrayCollection = new ArrayCollection ();
[Bindable] public var _is_full_screen:Boolean = false;
private function h_creation_complete (e:FlexEvent):void
{
var t_col_1:String = StringUtil.get_lorem (1, 2, false);
var t_col_2:String = StringUtil.get_lorem (1, 2, false);
var t_col_3:String = StringUtil.get_lorem (1, 2, false);
for (var i:uint = 0; i < 100; i++)
{
var t_obj:Object = new Object ();
t_obj [t_col_1] = StringUtil.get_lorem (1, 4, false);
t_obj [t_col_2] = StringUtil.get_lorem (1, 4, false);
t_obj [t_col_3] = StringUtil.get_lorem (1, 4, false);
this._ac.addItem (t_obj);
}
}
private function h_full_screen_button_click (e:MouseEvent):void
{
if (stage.displayState == StageDisplayState.NORMAL)
{
stage.displayState = StageDisplayState.FULL_SCREEN;
this._is_full_screen = true;
}
else
{
stage.displayState = StageDisplayState.NORMAL;
this._is_full_screen = false;
}
}
]]>
</mx:Script>

<mx:Panel
top="40" bottom="40" left="20" right="20"
title="Flex FAQ #5: All about Full Screen">

<mx:VBox width="100%" height="100%">

<mx:DataGrid width="100%" height="100%" dataProvider="{this._ac}" color="#666666" />

<mx:HBox width="100%">
<mx:Label width="100" text="{StringUtil.get_lorem (2, 3, false)}:" />
<mx:TextInput width="100%" text="{StringUtil.get_lorem (3, 5, false)}" />
<mx:Label
width="300" text="&lt; 抱歉. 我不能被修改. =.=" fontWeight="bold"
visible="{this._is_full_screen}" includeInLayout="{this._is_full_screen}" />
</mx:HBox>

<mx:HBox width="100%">
<mx:Label width="100" text="{StringUtil.get_lorem (2, 3, false)}:" />
<mx:TextInput width="100%" text="{StringUtil.get_lorem (3, 5, false)}" />
<mx:Label
width="300" text="&lt; Sorry. I can't be edited. =.=" fontWeight="bold"
visible="{this._is_full_screen}" includeInLayout="{this._is_full_screen}" />
</mx:HBox>

<mx:HBox width="100%" horizontalAlign="right">
<mx:Button label="全屏幕" click="{this.h_full_screen_button_click (event)}" />
<mx:Button label="Full Screen" click="{this.h_full_screen_button_click (event)}" />
</mx:HBox>

</mx:VBox>

</mx:Panel>

<mx:Label
top="10" left="10"
text="Fork me on GitHub."
color="#FFFFFF"
click="{navigateToURL (new URLRequest ('https://github.com/Vicker/flex-faq-005'));}"
/>

<mx:LinkButton
bottom="10" right="10"
label="Vicker's Coding Kitchen 2008. Creative Commons License."
click="{navigateToURL (new URLRequest ('http://vicker.cubeforge.net/blog'));}" />

</mx:Application>
Loading

0 comments on commit 8abd86c

Please sign in to comment.