مرجع ActionScript ...

Hamid_PaK

Member
با سلام ...
لطفا توضیحات کلاسها و یا فرمان های مربوط به اکشن اسکریپت فلش را همانند نمونه برای استفاده تمامی دوستان ضمیمه کنید ( پستهای بی ارتباط با موضوع حذف خواهند شد ).

  • نام کلاس و یا فرمان ...
  • توضیحات کلی درباره با کلاس و یا فرمان ...
  • نحوه استفاده از کلاس و یا فرمان ...
  • ضمیمه مثال ( در صورت امکان ) ...
  • و الا آخر ...

یا حق ...
 

Hamid_PaK

Member
ShareObject
  • يک کلاس آبجکت کاملا قدرتمند براي ذخيره داده ها ما بين کاربران يک کامپيوتر ...
  • توضيحات کلي درباره با خصوصيات و روالهاي اين کلاس
    کد:
    - Methods :
    SharedObject.clear() : Purges all of the data from the shared object and deletes the shared object from the disk.
    SharedObject.flush() : Immediately writes a locally persistent shared object to a local file.
    SharedObject.getLocal() : Returns a reference to a locally persistent shared object that is available only to the current client.
    SharedObject.getSize(): Gets the current size of the shared object, in bytes.
    
    - Properties (read-only) :
    SharedObject.data : The collection of attributes assigned to the data property of the object; these attributes can be shared and/or stored.
    
    - Event handler :
    SharedObject.onStatus : Invoked every time an error, warning, or informational note is posted for a shared object.
  • روش استفاده از کلاس
    کد:
    // لود کردن داده ها از فايل محلي در يک متغيير
    var shr_obj:SharedObject = SharedObject.getLocal( 'shr_obj_test' );
    
    // چک مي کنيم که آيا داده اي ذخيره شده است
    if (shr_obj.data.stored != undefined) {
    	trace( 'Data found and loaded ...' );
    } else {
    	trace( 'Data not found ...' );
    }
    
    // ذخيره ي يک داده در فايل محلي
    shr_obj.data.stored = 'ok, stored';
    shr_obj.flush();
  • لينک دانلود مثال : روش استفاده از کلاس ( ذخيره يک نوشته )

يا حق ...
 

Hamid_PaK

Member
XML
  • کلاس آبجکتي که به کاربر در بارگذاري داده ها از يک XML Data File کمک مي کند ...
  • توضيحات کلي درباره با خصوصيات و روالها :
    کد:
    - Methods :
    XML.addRequestHeader() : Adds or changes HTTP headers for POST operations.
    XML.appendChild() : Appends a node to the end of the specified object's child list.
    XML.cloneNode(): Clones the specified node and, optionally, recursively clones all children.
    XML.createElement(): Creates a new XML element.
    XML.createTextNode(): Creates a new XML text node.
    XML.getBytesLoaded(): Returns the number of bytes loaded for the specified XML document.
    XML.getBytesTotal(): Returns the size of the XML document, in bytes.
    XML.hasChildNodes(): Returns true if the specified node has child nodes; otherwise, returns false.
    XML.insertBefore(): Inserts a node in front of an existing node in the specified node's child list.
    XML.load(): Loads a document (specified by the XML object) from a URL.
    XML.parseXML(): Parses an XML document into the specified XML object tree.
    XML.removeNode(): Removes the specified node from its parent.
    XML.send(): Sends the specified XML object to a URL.
    XML.sendAndLoad(): Sends the specified XML object to a URL and loads the server response into another XML object.
    XML.toString(): Converts the specified node and any children to XML text.
    
    - Properties
    XML.contentType: Indicates the MIME type transmitted to the server.
    XML.docTypeDecl: Sets and returns information about an XML document's DOCTYPE declaration.
    XML.firstChild: Read-only; references the first child in the list for the specified node.
    XML.ignoreWhite: When set to true, text nodes that contain only white space are discarded during the parsing process.
    XML.lastChild: References the last child in the list for the specified node.
    XML.loaded: Read-only; checks if the specified XML object has loaded.
    XML.nextSibling: Read-only; references the next sibling in the parent node's child list.
    XML.nodeName: The node name of an XML object. 
    XML.nodeType: The type of the specified node (XML element or text node).
    XML.nodeValue: The text of the specified node if the node is a text node.
    XML.parentNode: Read-only; references the parent node of the specified node.
    XML.previousSibling: Read-only; references the previous sibling in the parent node's child list.
    XML.status: A numeric status code indicating the success or failure of an XML document parsing operation.
    XML.xmlDecl: Specifies information about a document's XML declaration.
    
    - Methods (Collections summary for the XML class)
    XML.attributes: Returns an associative array containing all of the attributes of the specified node.
    XML.childNodes: Read-only; returns an array containing references to the child nodes of the specified node.
    
    - Events handler
    XML.onData: An event handler that is invoked when XML text has been completely downloaded from the server, or when an error occurs downloading XML text from a server.
    XML.onLoad(): An event handler that returns a Boolean value indicating whether the XML object was successfully loaded with XML.load() or XML.sendAndLoad().
  • روش استفاده از کلاس :
    کد:
    // ذخيره کلاس در يک متغيير
    var xml_loader:XML = new XML();
    
    // تعريف رويداد بارگذاري
    xml_loader.onLoad = function ( rslt ) {
    	// ..
    	// statement
    	// .. trace( rslt );
    }
    
    // شروع بارگذاري با خواندن يک فايل
    xml_loader.load( 'xml_loader.xml' );
  • 1. لينک دانلود مثال : روش بارگذاري و نمايش داده ها
    2. لينک دانلود مثال : ساختن يک منو با خواندن آيتمهايش از يک فايل

يا حق ...
 

Hamid_PaK

Member
MovieClipLoader
  • کلاس آبجکتي که به شما اين امکان را مي دهد که بارگذاري يک فايل Jpeg و يا SWF را در يک MovieClip کنترل کنيد ...
  • قابل استفاده در Flash Player 7 و نسخه هاي بالاتر ...
  • توضيحات کلي درباره با خصوصيات و روالهاي اين کلاس ...
    کد:
    - Method
    MovieClipLoader.addListener(): Registers an object to receive notification when a MovieClipLoader event handler is invoked.
    MovieClipLoader.getProgress(): Returns the number of bytes loaded and total number of bytes for a file that is being loaded using MovieClipLoader.loadClip().
    MovieClipLoader.loadClip(): Loads a SWF or JPEG file into a movie clip in Flash Player while the original movie is playing. 
    MovieClipLoader.removeListener(): Deletes an object that was registered using MovieClipLoader.addListener().
    MovieClipLoader.unloadClip(): Removes a movie clip that was loaded by means of MovieClipLoader.loadClip().
    
    - Listener
    MovieClipLoader.onLoadComplete(): Invoked when a file loaded with MovieClipLoader.loadClip() has completely downloaded.
    MovieClipLoader.onLoadError(): Invoked when a file loaded with MovieClipLoader.loadClip() has failed to load.
    MovieClipLoader.onLoadInit(): Invoked when the actions on the first frame of the loaded clip have been executed.
    MovieClipLoader.onLoadProgress(): Invoked every time the loading content is written to disk during the loading process.
    MovieClipLoader.onLoadStart(): Invoked when a call to MovieClipLoader.loadClip() has successfully begun to download a file.
  • روش استفاده از اين کلاس ...
    کد:
    // تعريف اين کلاس در يک متغيير
    var clip_loader:MovieClipLoader = new MovieClipLoader();
    
    // تعريف يک شنونده در يک متغيير
    var mi_listener:Object = new Object();
    
    // اضافه کردن يک تابع در رويداد "بارگذاري با اشکال" در شنونده
    mi_listener.onLoadError = function (target_mc:MovieClip, errorCode:String) {
      // statement ...
    }
    
    // اضافه کردن يک تابع در رويداد "بارگذاري تکميل شد" در شنونده
    mi_listener.onLoadComplete = function (target_mc:MovieClip) {
      // statement ...
    }
    
    // اضافه کردن شنونده به کلاس بارگذار
    clip_loader.addListener(mi_listener);
    
    // درخواست بارگذاري فايل مورد نظر ، شما در آرگمان دوم بايد نام و يا آدرس يک موي کليپ را وارد کنيد ...
    clip_loader.loadClip('swf_or_jpeg_filename', movie_name);
  • نکته : شما در هنگام بارگذاري مي توانيد با روال ()getProgress وضعيت بارگذاري را نيز چک کنيد ...
  • لينک دانلود مثال : تعريف و روش استفاده (بارگذاري يک SWF)

يا حق ...
 

Hamid_PaK

Member
ContextMenu
  • کلاس آبجکتي براي سختن منوي هاي زمينه با آيتمهاي دلخواه و جايگزيني آن با منوي کليک راست فلش ...
  • توضيحات کلي درباره با خصوصيات و روالهاي اين کلاس ...
    کد:
    - Methods :
    ContextMenu.copy(): Returns a copy of the specified ContextMenu object.
    ContextMenu.hideBuiltInItems(): Hides most built-in items in the Flash Player context menu.
    
    - Properties :
    ContextMenu.builtInItems: An object whose members correspond to built-in context menu items.
    ContextMenu.customItems: An array, undefined by default, that contains ContextMenuItem objects.
    
    - Event handler
    ContextMenu.onSelect: Invoked before the menu is displayed.
  • روش استفاده از اين کلاس ...
    کد:
    // تعريف اين کلاس در يک متغيير
    var my_cm:ContextMenu = new ContextMenu(menuHandler);
    
    // اضافه کردن يک آيتم به ليست
    my_cm.customItems.push(new ContextMenuItem("Hello", itemHandler));
    
    // کنترل و نظارت در اجراي آيتمها
    function menuHandler(obj:Object, menuObj:ContextMenu) {
       // statement ...
       // menuObj: witch item run ...
    }
    
    // کنترل و نظارت در يک آيتم خاص
    function itemHandler(obj, item) {
       // statement ...
       // when item run ...
    }
    
    // تعريف منوي ساخته شده در روت پروژه
    _root.menu = my_cm;
  • لينک دانلود مثال : تعريف و روش استفاده

يا حق ...
 

Hamid_PaK

Member
getBytesTotal & getBytesLoaded
  • شما به کمک اين فرمان ها به ترتيب مي توانيد مقدار بايت لود شده و مجموع کل حجم موي کليپ به بايت را دريافت کنيد ...
  • قابل استفاده در Flash Player 5 و نسخه هاي بالاتر ...
  • توضيحات کلي درباره با خصوصيات و آرگمانهای اين فرمان ها ...
    هیچ آرگمانی ندارند.
    اين روال ها جزو متودهاي MovieClipها هستند : ;()instanceName.getBytesTotal(); or _root.getBytesTotal
    خروجي اين فرمان ها يک عدد صحيح مي باشد.
  • روش استفاده از اين فرمان ...
    کد:
    // دريافت کل بايتهاي روت کليپ
    var t_byte = _root.getBytesTotal();
    
    // دريافت مقدار بايت لود شده روت کليپ
    var l_byte = _root.getBytesLoaded();
    
    // نمايش مقادير
    trace( 'Total: '+t_byte+' Loaded:'+l_byte );
  • نکته :
    1. روت کليپ نيز جزو MovieClipها محسوب مي شود ...
    2. اين فرمان ها براي ساختن لودر بسيار مفيد هستند ...
  • لينک دانلود مثال : روش استفاده (نمونه کليپ لودر)

يا حق ...
 
آخرین ویرایش:

Hamid_PaK

Member
loadVariables
  • شما به کمک اين فرمان می توانید متغییرها را از یک منبع خروجی در یک مقصد ( Target ) و یا رتبه ( Level ) خاص بارگذاری کنید ...
  • قابل استفاده در Flash Player 4 و نسخه هاي بالاتر ...
  • توضيحات درباره با روش استفاده و آرگمانهاي اين فرمان ...
    loadVariables(url:String, target:Object, [method:String]) : Void
    آرگمان ها به ترتیب :
    1. آدرس فایل مورد نظر برای بارگذاری ( می تواند یک فایل فلش ، PHP ، ASP ، نوشتاری و ... باشد ) از نوع رشته
    2. آدرس مقصد بارگذاری متغییرها ( می تواند آدرس یک MovieClip و یا روت پروژه باشد ) از نوع آبجکت
    3. نوع روش بارگذاری ( می تواند POST و یا GET باشد ) از نوع رشته

    خروجي اين فرمان تهی می باشد.
  • لينک دانلود مثال : روش استفاده ( بارگذاری متغییرها از یک فایل نوشته )

يا حق ...
 
بالا