Flash Btn getproperty
i tried to create a btn and wanna to get the btn’s name(instant) and pass to funciton
Where target is the instance name of the object within the Flash movie which we are interested in examining, and property indicates the property we wish to evaluate. The target is generally the path to a movie clip (see the Paths tutorial for more on paths).
This table outlines the code you can substitute in for the property attribute, and what it will get you.
| getProperty ( target, _x ); | The X position (in pixels) of the target clip. |
| getProperty ( target, _y ); | The Y position (in pixels) of the target clip. |
| getProperty ( target, _width ); | The width (in pixels) of the target clip. |
| getProperty ( target, _height ); | The height (in pixels) of the target clip. |
| getProperty ( target, _rotation ); | The rotation angle (in degrees) of the target clip. |
| getProperty ( target, _target ); | The full path (from _root) to the target clip. |
| getProperty ( target, _name ); | The instance name of the target clip. |
| getProperty ( target, _xscale ); | The X scale proportion relative to the original clip size, (in percent) of the target clip. |
| getProperty ( target, _yscale ); | The Y scale proportion relative to the original clip size, (in percent) of the target clip. |
| getProperty ( target, _alpha ); | The alpha fade level (in percent) of the target clip. |
| getProperty ( target, _visible ); | The visibility status (Boolean: True of False, 1 or 0) of the target clip. |
| getProperty ( target, _droptarget ); | The instance name of the clip upon which a draggable clip is dropped. |
| getProperty ( target, _currentframe ); | The frame at which the playhead currently rests in the target clip. |
| getProperty ( target, _totalframes ); | The total number of frames in the target clip. |
| getProperty ( target, _framesloaded ); | The number of frames currently loaded in the target clip. |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
on (press) {
getname = getProperty(store2,_name);
loadXMLText(getname);
}
store2 is the btn’s instant name
Add comment 十一月 16, 2009
Flash Btn AddEventListener
只可以用係window –>component
下面用左window –>component–>button 做test, 成功!!!!
下列範例會定義一個偵聽程式物件 myListener,並且定義 click 事件的回呼函數。接著它會呼叫 addEventListener(),向組件實體 myButton 註冊 myListener 偵聽程式物件。
myListener = new Object();
myListener.click = function(evt){
trace(evt.type + " triggered");
}
myButton.addEventListener("click", myListener);
若要測試這個程式碼,請在「舞台」上放置一個 Button 組件,將實體名稱設定為 myButton,並且在「影格 1」加入此程式碼。
Add comment 十一月 16, 2009
Full Screen in Flash
action script at the scene1 , frame 1
Stage.align = “LT”;
Stage.scaleMode = “noScale”;
getURL(“FSCommand:fullscreen”, 1);
*****************************************************************
“logo” is the name of the movie clip in Scene 1, frame 1
logo.onResize = function ()
{
this._y = Math.round(Stage.height / 2);
this._x = Math.round(Stage.width / 2);
};
Stage.addListener(logo);
logo.onResize();
Add comment 十一月 11, 2009
Flash auto-fit into the screen or web browser
Quoted from http://www.aleosoft.com/flashtutorial_autofit.html:
How to make a Flash SWF file auto-fit into the screen or web browser?
After you have included the Flash SWF file to your HTML page, you can open the HTML page with your HTML editor and edit the HTML code.
Look for the code that embeds the Flash Movie. It should look similar to this:
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0″ width=”480″ height=”125″>
<param name=”movie” value=”flashmovie.swf” />
<param name=”quality” value=”high” />
<embed src=”flashmovie.swf” quality=”high” type=”application/x-shockwave-flash” width=”480″ height=”125″ pluginspage=”http://www.macromedia.com/go/getflashplayer” />
</object>To make the Flash auto zoom and auto fit into its container, you should change the code as following. The changes are shown in red.
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0″ width=”100%” height=”100%”>
<param name=”movie” value=”flashmovie.swf” />
<param name=”quality” value=”high” />
<PARAM NAME=”SCALE” VALUE=”exactfit”>
<embed src=”flashmovie.swf” quality=”high” type=”application/x-shockwave-flash” width=”100%” height=”100%” SCALE=”exactfit” pluginspage=”http://www.macromedia.com/go/getflashplayer” />
</object>
To make the Flash auto zoom and auto fit into its container without distortion, that’s, keep the aspect ratio, you should change the code as following. The changes are shown in red.
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0″ width=”100%” height=”100%”>
<param name=”movie” value=”flashmovie.swf” />
<param name=”quality” value=”high” />
<PARAM NAME=”SCALE” VALUE=”default”>
<embed src=”flashmovie.swf” quality=”high” type=”application/x-shockwave-flash” width=”100%” height=”100%” SCALE=”default” pluginspage=”http://www.macromedia.com/go/getflashplayer” />
</object>
Add comment 十一月 10, 2009