Using an array to help achieve the cycle of rolling (as2.0)

var mc_width = 200;
var mc_height = 100;
var mcNum = 10;
var move_v = 0;
var prev_v = 0;
var stageHeight = Stage.height;
var mc_array = [];
for (var i = 0; i mc_array[i] = newMC(10, i*mc_height, mc_width, mc_height, i+1);
}
onEnterFrame = function () {
move_v = (move_v+(_ymouse-stageHeight/2)/10+mc_height)%mc_height;
var v = move_v-prev_v;
if (Math.abs(v)>mc_height/2) {
v<0 ? mc_array.push(mc_array.shift()) : mc_array.unshift(mc_array.pop());
}
prev_v = move_v;
mc_array[0]._y = -move_v;
for (var i = 1; i mc_array[i]._y = mc_array[i-1]._y+mc_height;
}
};
function newMC(x, y, width, height, text) {
var c = _root.getNextHighestDepth();
var mc:MovieClip = _root.createEmptyMovieClip(”mc”+c, c);
mc._x = x;
mc._y = y;
var txt:TextField = mc.createTextField(”txt”, 0, 0, height/2-30, width, 60);
txt.text = text;
txt.selectable = false;
var format:TextFormat = new TextFormat();
format.align = “center”;
format.size = 40;
format.font = “Arial Black”;
txt.setTextFormat(format);
mc.lineStyle(1, 0);
mc.moveTo(0, 0);
mc.lineTo(width, 0);
mc.lineTo(width, height);
mc.lineTo(0, height);
mc.lineTo(0, 0);
mc.endFill();
return mc;
}

Leave a Comment

aXmag PDF to Flash Conversion

Designed for 3D interactive online digital magazine publication, aXmag PDF to Flash converter is innovative for creating page flipping reading experiences online.

* Small converted file size
* High-fidelity image
* Stepless magnification
* High conversion quality
* Streaming page loading

Visit tool homepage: http://www.axmag.com/

Leave a Comment

as3 use regular

1. At the beginning and end of all of “/”, but at the end of “/” after the can with the specific expression of particular significance identifier. G such that patterns behind the increase is global.

2. Can be defined in two ways, for example, the following two, they are equivalent:

var pattern1: RegExp = / bob / i

var pattern2: RegExp = new RegExp (”bob”, “i”);

RegExp () in the two parameters, the second parameter that tag.

3. If the regular expression in “/”, etc., need to add in front of “\”, such as / 1 \ / 2 / that 1 / 2. (Like C + + in the escape character)

4. Metacharacters: ^ $ \. * +? () [] () | Regular expression that they have special significance. Brief list is as follows:

^ (Caret) Matches at the start of the string.

$ (Dollar sign) Matches at the end of the string.

\ (Backslash) Escapes the special metacharacter meaning of special characters.

. (Dot) Matches any single character.

* (Star) Matches the previous item repeated zero or more times.

+ (Plus) Matches the previous item repeated one or more times.

? (Question mark) Matches the previous item repeated zero or one time.

(And) Defines groups within the regular expression.

[And] Defines a character class, which defines possible matches for a single

character

| (Pipe) Used for alternation, to match either the part on the left side or the part on

the right side

5. Per sequence. In the regular expression in a sequence of characters with special meaning. Brief list is as follows:

(N) (n,) and (n, n) Used to identify a specific numeric quantifier or quantifier range for the previous item

\ A Matches at the start of the string to which the regular expression is applied

\ B Matches at the position between a word character and a non-word character

\ B Matches at the position between two word characters.

\ D Matches a digit.

\ D Matches any character other than a digit.

\ N Matches the newline character.

\ R Matches the return character.

\ S Matches any whitespace character (a space, tab, newline, or return character)

\ S Matches any character other than a whitespace character.

\ T Matches the tab character.

\ Unnnn Matches the Unicode character with the character code specified by the

hexidecimal number nnnn.

\ W Matches a word character (A-Z, a-z, 0-9, or _).

\ W Matches any character other than a word character.

\ Xnn Matches the character with the specified ASCII value, as defined by the

hexidecimal number nn.

\ Z Matches the end of the string to which the regular expression is applied.If the string ends with a line break, matches before the final line break.

\ Z Matches the end of the string to which the regular expression is applied.If the string ends with a line break, matches after the final line break.

6.regular expression of the flags.

Flag Property Description

g global Matches more than one match.

i ignoreCase Case-insensitive matching.

m multiline With this flag set, $ and ^ can match the beginning of a line and end of a line, respectively

s dotall With this flag set,. (dot) can match the newline character (\ n).

x extended Allows extended regular expressions.

7. Two methods: exec (), test (). test () is used to detect whether a string containing the characters to match, the return value is boolean value. exec () for pattern matching, and returns an array.

Leave a Comment

Flex4 two-way data binding

Method 1: Use the @ symbol

1. < ? Xml version = "1.0" encoding = "utf-8"?>
2. < S: Application xmlns: fx = "http://ns.adobe.com/mxml/2009"
3. Xmlns: s = "library: / / ns.adobe.com / flex / spark"
4. Xmlns: mx = "library: / / ns.adobe.com / flex / halo"
5. MinWidth = "1024"
6. MinHeight = "768">
7. < S: TextInput id = "t1"
8. Text = "@ (t2.text)" />
9. < s:TextInput Id="t2" x="2" y="31"/>
10.
11. < / S: Application>

Example 1

Method 2: Using the Binding tab

1. < ? Xml version = "1.0" encoding = "utf-8"? >
2. < S: Application xmlns: fx = "http://ns.adobe.com/mxml/2009"
3. Xmlns: s = "library: / / ns.adobe.com / flex / spark"
4. Xmlns: mx = "library: / / ns.adobe.com / flex / halo"
5. MinWidth = "1024"
6. MinHeight = "768" >
7. < Fx: Binding source = "t1.text"
8. Destination = "t2.text"
9. TwoWay = "true" />
10. < S: TextInput id = "t1"
11. X = "10"
12. Y = "8" />
13. < S: TextInput id = "t2"
14. X = "10"
15. Y = "42" / >
16. < / S: Application >

Example Ibid

Note that using the latest version of Flash Builder 4 beta, is almost Binding tags twoWay not normal tips, but is correct.

Please use the above example Flash10 View

Leave a Comment

Flex 4 in the new data types: ArrayList

The introduction of the Flex 4 in a new data type: ArrayList. It implements the IList interface to the underlying Array as a data source. Essentially it is a lightweight ArrayCollection, can be used as a data source bound to the control. But ArrayCollection different is that it can not filter and filter arrays.

Example:


xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
< fx:Declarations>
< s:ArrayList id="al">
< fx:Object type="Line" class="LineSeries"/>
< fx:Object type="Mountain" class="AreaSeries"/>
< fx:Object type="Candlestick" class="CandlestickSeries"/>
< fx:Object type="HLOC" class="HLOCSeries"/>
< /s:ArrayList>
< /fx:Declarations>
< s:DropDownList dataProvider="{al}"
labelField="type" selectedIndex="0"/>
< /s:Application>< /blockquote>

Note that the list of Spark control is based not directly to Array as data provider, we must realize IList interfaces. This should be the introduction of one of the reasons ArrayList data type.

Leave a Comment

as3 double-failure problem

If the movie clip mc included in other movie clips.

mc’s double event this time will not trigger,

The solution is
mc.mouseChildren=false;

mc.doubleClickEnabled=true;

mc.addEventListener(MouseEvent.DOUBLE_CLICK,mcHandler);

function mcHandler(e:MouseEvent):void

{

trace(e.target.name);

}

Leave a Comment

Flash Player10.1 and AIR2.0 official version (desktop version) released

  • Flash Player 10.1 Download full version: http://www.adobe.com/go/getflashplayer
  • Download Flash Player 10.1 Genuine Edition Debugger: http://www.adobe.com/support/flashplayer/downloads.html
  • Download AIR 2.0 official version: http://www.adobe.com/go/getair

Leave a Comment

Insert a Flash object into the Form, there js not have access to Flash object error

<form>
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″
id=”flashObj” 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” />
</object>
</form>
In the js in if you want to have access to flashObj this object, and send some information to the flash (swfaddress, swfobject), will be mistakes.
Of the affected version is 9.0.28, later versions do not have this problem.
The solution is not to put form in flash.

Leave a Comment

as3 load the main scenario the use of external libraries

The main module main.swf, is called the module lib.swf,
lib.fla of the document class Lib.as, assume that the defined module Module0.as, Module1.as [Read the rest of this entry...]

Leave a Comment

as3 class constructor sequence dependent

1, if the constructor does not show that the super, will automatically call the super constructor beginning of the parent structure. [Read the rest of this entry...]

Leave a Comment