ActionScript 3.0 миний 3-н жилийн өмнөх дутуу орчуулга :d :-p

Posted: 12 сар 26, 2010 in Проргамчлал, mxml , actionscript3

ActionScript 3.0

Flash Player runtime.flash player програмын хөгжил нэг чухал том алхам нь обект хандалтат хэл болох actionscript 3.0  юм ActionScript 3.0  нь үүсэх болсон шалтгаан нь итернэтэд тохирсон  хурдан хөрвөх чадвартай сайн ажиллагаатай хурдан програм хэрэгтэй байсан явдал юм. Энэ нь вэб-с олж авсан туршлага дээрээс үндэслэн бий болсон.

Өмнөх хувилбарууд нь нарийн төвөгтэй бүтээл дээр интернэт-н орчинд уян хатан биш, хөрвөх чадвар муу байсан.
ActionScript 3.0 –хэлний хөгжил нь хөдөлгөөнт дуу дүрс бүхий мэдээлэлийг интернэт-н орчинд  (хялбар ,ажиллагааг хөнгөвчилсөн цогц програм ба том хэмжээний мэдээний бааз,обект хандалт програмчлал, хурдан хөвүүлэлт зэрэг ) сайн ажилж чаддаг. Flash Player дээр ActionScript 3.0-г хөжүүлэгчид нь өөрийн бүтээлүүдийн санга үүсгэж боловсруулж байна.

ActionScript 3.0 нь ECMAScript дээр суурилсан, the international standardized programming language for scripting. ActionScript 3.0 нь ECMAScript хэлний онцлог шинж-г агуулсан, Third Edition (ECMA-262). It also contains functionality based on ongoing work on ECMAScript Edition 4, occurring within the ECMA standards body.

ActionScript про-н хэл нь the ActionScript Virtual Machine (AVM) болох the Flash Player. AVM1 дээр хөрвөгдөн ажилладаг,  Flash Player өнөөдөрийн байдлаар хамгийн өргөн тархсан олон талт мэдиа програм юм.

Мөн хөжүүлэгчидэд AVM1 –н хязгаарыг давсан шаардлага бий болгосноор гэнэтийн өөрчлөлт хэрэгтэй болсон. Тийм учираас ActionScript 3.0 хэл дээр тулгуурлан ActionScript Virtual Machine AVM1 дээр нэмж өргөтгөн шинэ өндөр чадамж бүхий  AVM2-г гаргаж ирэх хэрэгтэй болсон. ActionScript 3.0 нь хуучин ActionScript code-с 10 дахин илүү хурдан ажиладаг болсон.

Шинэ AVM2 virtual machine нь Flash Player 9 нэртэйгээр гарч ирсэн, сайжруулан гаргаж ирсэн хувилбар дээр хуучин AVM1 дээр ажилладаг байсан бүх мэдиа файлуудыг дэмжин ажилж чаддаг байна.

Flash Player ажиллах явцдаа олон тооны мэдиа файл-г хөвүүлж чаддаг ба ActionScript-с өгөгдсөн код-г олон дахин нэгтгэн нийлүүлж дэмжин найруулж хөрвүүлэн үзүүлдэг. In the Adobe product family,  Мөн дэсайнер болон хөгжүүлэгч мэргэжилтнүүдэд зориулсан хэрэгсэлүүд болох  Flex,  Flash Media Server—зэргийг дэмжин ажиллана.

ActionScript 3.0 нь XML script-тэй зохицон ажилладаг. Мөн ажилж байгаа санах ойд бага зай эзэлж ажилладаг

Flash программ нь хийгдэж байгаа хєдєлгєєн буюу киног єєрийн ActionScript-ийн тусламжтайгаар программчилж болно. Жишээ нь: хєдєлгєєн, дууны бvхий л хяналт, давталт, Scene хооронд чєлєєтэй шилжих, loading хийх, scroll, Flash тоглоом, тооны машин, хэрэглэгчийн нэр болон нууц vг гэх мэт янз бvрийн функц шалгах олон тєрлийн боломжтай.
ActionScript нь єєрийн гэсэн нэр томъёотой байдаг хэдий ч бусад Script-vvдтэй тєстэй байдаг. Єєрєєр хэлбэл зарчим нь ижил. Хэрэв та ямар нэгэн Script хэлний бага зэрэг мэдлэгтэй бол ойлгоход илvv хялбар байх болно. Энэ талаарх дэлгэрэнгvй мэдээллийг Flash программыг тусламжаас (Help F1) vзэж болно. Хєдєлгєєнд ActionScript оруулах гол зарчим нь харгалзах объект болон фреймийг идэвхижvvлэн Action Panel (панел)-д байх бэлэн функцуудэд утгыг нь (параметр) оруулах явдал юм.

Method

Өөрийн гэсэн method болон  фүнкцүүд бүхий кодтой ба зарим нэг хэсгийг доор тайлбарлав.

I нэртэй Number хувьсагч зарлаад 0 гэсэн утга оноож байна.
var i:Number = 0;

Мөн энд myMessage гэсэн String төрөлтэй хувьсагчид утга олгож байна.
var myMessage:String = “IMPORTANT: Never, ever embed all the available characters. If you aren’t going to use them, what’s the point? This is important because every character that you embed in your SWF movie, adds to its filesize. If you select Uppercase, Lowercase and Numerals group, your SWF will have a filesize of about 5 KB. If you include all the characters, your file size will grow to 170 KB. And that surely doesn’t make any sense.\n:)”;

Энэ доорх фүнкц нь автоматаар дуудагдах ба monitor_txt гэсэн дэлгэцэн дээрх textbox дотор өгүүлбэрийг үсэг үсэгээр цувруулан хэвлэнэ. Энэ нь бусад програм дээрх энгийн үйлдэлүүдтэй адил юм.

function autoWrite() {

if (i <= myMessage.length) {

monitor_txt.text = myMessage.substr(0, i)+&#8221;█&#8221;;

i = i+1;

} else {

clearInterval(writingInterval);

}

}

var writingInterval:Number = setInterval(autoWrite, 20);

Энэд m restart_btn гэсэн товч дээр дарах үед clickHandler фүнкцийг дуудаж байна ,мөн MouseEvent.CLICK буюу хулганы шинж чанар дээр даралт хийх үед дуудна гэж зааж байна.
restart_btn.addEventListener(MouseEvent.CLICK, clickHandler);

function clickHandler(event:MouseEvent):void {

i=0; var writingInterval:Number = setInterval(autoWrite, 20);

}

XML

ActionScript 3.0 нь XML script ттэй зохицон ажилладаг ба өөрийн фүнкцүүдийн тусламжтайгаар XML-с ActionScript 3.0 луу мөн түүнээс XML хэл рүү ActionScript 3.0 –н кодчлолын хэлийг ашиглан хөрвүүлэлт хийж болдог байна. Тэгэснээрээ PHP script тэй холбогдон dynamic вэб хуудасыг хийх юм.

Regular expressions

ActionScript 3.0 includes native support for regular expressions so you can quickly search for and manipulate strings. ActionScript 3.0 implements the regular expressions defined in the ECMAScript Language Specification (ECMA-262).

Namespaces

Namespaces are an innovative new mechanism for controlling visibility of declarations. Similar to the traditional access specifiers used to control visibility of declarations (public, private, protected), namespaces are essentially custom access specifiers, which can have names of your choosing. The Flex framework, for example, uses an mx_internal namespace for its internal data. Namespaces are outfitted with a Universal Resource Identifier (URI) to avoid collisions, and are also used to represent XML namespaces when working with E4X.

New primitive types

ActionScript 2.0 had a single numeric type, Number, a double-precision floating point number. One welcome addition to ActionScript 3.0 is the new int type—a 32-bit signed integer that lets ActionScript code take advantage of the fast integer math capabilities of the CPU. The int type is great for loop counters and almost anywhere a decimal point isn’t needed. Another new type is uint, an unsigned 32-bit integer type similar to int.

Flash Player API features

The Flash Player API is a set of classes and functions that expose the capabilities of Flash Player to the ActionScript language. This functionality is the bridge between the ActionScript core language and the rest of the platform. It is the source of much of the power available to Flash applications and is a very important complement to the core language. Although there isn’t space here to cover the APIs in detail, here is a short list of some of the new and interesting functionality available to developers:

DOM3 event model

The event model provides a standard way of generating and handling event messages so that objects within applications can interact and communicate, maintaining state and responding to change. Patterned after the W3C DOM3 Events specification, this model provides a clearer and more efficient mechanism than the event systems available in previous versions of ActionScript. The Flex application framework uses the same event model as the Flash Player API, so the event system is unified across the platform from top to bottom.

Display List API

The Display List API consists of a revamped set of classes for working with the visual primitives in Flash.

The new Sprite class is a lightweight building block, similar to MovieClip but more appropriate as a base class for UI components. The new Shape class represents raw vector shapes. These classes can be instantiated naturally with the new operator and can be dynamically re-parented at any time.

There is no longer any need to assign depth numbers to display list objects. Depth management is now automatic and built into Flash Player. New methods are provided for specifying and managing the z-order of objects.

Where to go from here

This ActionScript 3.0 overview outlines only a few of the exciting APIs and language features you’ll discover as you learn more about ActionScript 3.0. Programming ActionScript 3.0 on LiveDocs (or as PDF) is a good place to start for information on how to implement programming concepts in ActionScript, and the ActionScript 3.0 Language Reference will be the definitive source for complete information about the core language and the Flash Player API. Also, if you’re already familiar with ActionScript 1.0 or 2.0, check out Tips for Learning ActionScript 3.0.

The Flash Player team is thrilled to be able to deliver a preview of the language, its new capabilities, and improved performance to the community through Adobe Labs. You will be able to explore ActionScript 3.0 to see where we are taking the language through Flex Builder 2, the Flex framework, Flex Data Services 2, and Flash Player 9. We hope you are as excited as we are about the future of the platform, and look forward to the feedback you will provide us through Adobe Labs.

About the authors

Gary Grossman is a software architect who works on Flash Player at Adobe. Gary joined the Flash team at Macromedia in 1998 and has worked on every release of Flash since Flash 4 in a variety of capacities, from engineering to management. He has had the pleasure of working alongside such Flash luminaries as Jonathan Gay, the original inventor and author of Flash. Gary was the primary developer on the ActionScript programming language in Flash 4, Flash 5, and Flash MX. He continues to participate actively in the evolution of the ActionScript programming language. Gary lives and works in San Francisco, California.

Emmy Huang is the senior product manager for Adobe Flash Player. Her experience includes working in engineering and product management on a range of digital entertainment technologies at Sony Pictures Digital, Liberate Technologies, and Intel. She briefly flirted with the idea of switching to another industry while working towards her MBA at UCLA but decided that working in software was way more fun than selling bleach.

Сэтгэгдэлүүд
  1. burenbat хэлдэг:

    ActionScript 3.0 iin talaar dahin johon delgeruulj jishee oruulj ogvol ih zugeer ym bn. Bayarlalaa

Leave a reply to burenbat Хариулт болиулах