目前分類:AS3 (35)

瀏覽方式: 標題列表 簡短摘要
1: import flash.events.MouseEvent;
2: import flash.net.URLRequest;
3: import flash.net.navigateToURL;

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

以下例子為把一堆bitmapData 變成jpeg 並直接輸出成zip file 給人下載.



shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

来源:
http://kb2.adobe.com/cps/164/tn_16417.html

  All browsers will support string sizes of up to 64KB (65535 bytes) in length. FlashVars must be assigned in both the OBJECT and EMBED tags in order to work on all browsers.

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

  

  1. var RightClick = { 
  2.     /** 
  3.      *  Constructor 
  4.      */  
  5.     init: function () { 
  6.         this.FlashObjectID = "customRightClick"; 
  7.         this.FlashContainerID = "flashcontent"; 
  8.         this.Cache = this.FlashObjectID; 
  9.         if(window.addEventListener){ 
  10.              window.addEventListener("mousedown", this.onGeckoMouse(), true); 
  11.         } else { 
  12.             document.getElementById(this.FlashContainerID).onmouseup = function() { document.getElementById(RightClick.FlashContainerID).releaseCapture(); } 
  13.             document.oncontextmenu = function(){ if(window.event.srcElement.id == RightClick.FlashObjectID) { return false; } else { RightClick.Cache = "nan"; }} 
  14.             document.getElementById(this.FlashContainerID).onmousedown = RightClick.onIEMouse; 
  15.         } 
  16.     }, 
  17.     /** 
  18.      * GECKO / WEBKIT event overkill 
  19.      * @param {Object} eventObject 
  20.      */ 
  21.     killEvents: function(eventObject) { 
  22.         if(eventObject) { 
  23.             if (eventObject.stopPropagation) eventObject.stopPropagation(); 
  24.             if (eventObject.preventDefault) eventObject.preventDefault(); 
  25.             if (eventObject.preventCapture) eventObject.preventCapture(); 
  26.          if (eventObject.preventBubble) eventObject.preventBubble(); 
  27.         } 
  28.     }, 
  29.     /** 
  30.      * GECKO / WEBKIT call right click 
  31.      * @param {Object} ev 
  32.      */ 
  33.     onGeckoMouse: function(ev) { 
  34.         return function(ev) { 
  35.         if (ev.button != 0) { 
  36.             RightClick.killEvents(ev); 
  37.             if(ev.target.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) { 
  38.                 RightClick.call(); 
  39.             } 
  40.             RightClick.Cache = ev.target.id; 
  41.         } 
  42.       } 
  43.     }, 
  44.     /** 
  45.      * IE call right click 
  46.      * @param {Object} ev 
  47.      */ 
  48.     onIEMouse: function() { 
  49.         if (event.button> 1) { 
  50.             if(window.event.srcElement.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) { 
  51.                 RightClick.call();  
  52.             } 
  53.             document.getElementById(RightClick.FlashContainerID).setCapture(); 
  54.             if(window.event.srcElement.id) 
  55.             RightClick.Cache = window.event.srcElement.id; 
  56.         } 
  57.     }, 
  58.     /** 
  59.      * Main call to Flash External Interface 
  60.      */ 
  61.     call: function() { 
  62.         document.getElementById(this.FlashObjectID).rightClick(); 
  63.     } 
  64. }  

以下是as部分代码:

  

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

/*
Ticore's Blog

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

AS2 強迫全面更新畫面的方式:
_root.onEnterFrame = function() {
clear();

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

import flash.sampler.*;
import flash.display.*;

trace("new Number() : ", getSize(new Number()));
trace("new int() : ", getSize(new int()));
trace("new uint() : ", getSize(new uint()));
trace("new Boolean() : ", getSize(new Boolean()));
trace("new Object() : ", getSize(new Object()));
trace("new Array() : ", getSize(new Array()));
trace("new String() : ", getSize(new String()));
trace("new Date() : ", getSize(new Date()));
trace("new XML() : ", getSize(new XML()));
trace("new XMLList() : ", getSize(new XMLList()));
trace("new RegExp() : ", getSize(new RegExp()));
trace("new Function() : ", getSize(new Function()));
trace("new Sprite() : ", getSize(new Sprite()));
trace("new MovieClip() : ", getSize(new MovieClip()));


trace("Number : ", getSize(Number));
trace("int : ", getSize(int));
trace("uint : ", getSize(uint));
trace("Boolean : ", getSize(Boolean));
trace("Object : ", getSize(Object));
trace("Array : ", getSize(Array));
trace("String : ", getSize(String));
trace("Date : ", getSize(Date));
trace("XML : ", getSize(XML));
trace("XMLList : ", getSize(XMLList));
trace("RegExp : ", getSize(RegExp));
trace("Function : ", getSize(Function));
trace("Sprite : ", getSize(Sprite));
trace("MovieClip : ", getSize(MovieClip));


trace("[] : ", getSize([]));
trace("[0] : ", getSize([0]));
trace("[0, 1] : ", getSize([0, 1]));
trace("[null, null] : ", getSize([null, null]));
trace("new Array(0) : ", getSize(new Array(0)));
trace("new Array(1) : ", getSize(new Array(1)));


trace("{} : ", getSize({}));
trace("{a: 'a'} : ", getSize({a: 'a'}));
trace("{a: 'ab'} : ", getSize({a: 'ab'}));
trace("{a: {}} : ", getSize({a: {}}));

trace("{a: 'a', b: 1} : ", getSize({a: 'a', b: 1}));
trace("{a: null, b: null} : ", getSize({a: null, b: null}));


trace("1 : ", getSize(1));
trace("1.1 : ", getSize(1.1));

trace("'A' : ", getSize('A'));
trace("'AB' : ", getSize('AB'));
trace("'ABC' : ", getSize('ABC'));

function fun1():void{};
function fun2(arg1:*):void{var a:* = 1;};

trace("fun1 : ", getSize(fun1));
trace("fun2 : ", getSize(fun2));

输出结果:

new Number() :  4
new int() :  4
new uint() :  4
new Boolean() :  4
new Object() :  24
new Array() :  40
new String() :  28
new Date() :  32
new XML() :  16
new XMLList() :  32
new RegExp() :  48
new Function() :  588
new Sprite() :  464
new MovieClip() :  496
Number :  1133
int :  856
uint :  856
Boolean :  452
Object :  3282
Array :  4204
String :  3319
Date :  8235
XML :  4818
XMLList :  3118
RegExp :  1008
Function :  977
Sprite :  1602
MovieClip :  2182
[] :  40
[0] :  44
[0, 1] :  48
[null, null] :  48
new Array(0) :  40
new Array(1) :  40
{} :  24
{a: 'a'} :  32
{a: 'ab'} :  32
{a: {}} :  32
{a: 'a', b: 1} :  40
{a: null, b: null} :  40
1 :  4
1.1 :  8
'A' :  30
'AB' :  32
'ABC' :  34
fun1 :  32
fun2 :  32

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

packageproject.test
{
importflash.display.*;

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

package {
import flash.display.Sprite;
import flash.events.Event;

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

◾建立 Flex Lib. Project
◾加入編譯參數 -compute-digest=false
◾建立並且指定編譯參數 manifest.xml

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

Flash AS3 用

 

root.loaderInfo.parameters // 或 stage.loaderInfo.parameters

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

ModalDisplayManager.as

/*
Copyright (c) 2008 Yahoo! Inc. All rights reserved.

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

本例將值放入vars 陣列內:

 

var flashvars:Object = stage.loaderInfo.parameters;

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

1: import flash.events.MouseEvent;
2: import flash.geom.Point;
3: import flash.display.Sprite;

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

as3

 


shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()



        

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

主時間軸:

import BMPDecoder;
loadBMPFile("1.bmp");

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

            var sendXml:String="<r><i>"
+ "<a><![CDATA[" + username + "]]></a>"
+ "<b><![CDATA[" + password + "]]></b>"

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

/*
Copyright (c) 2008 NascomASLib Contributors.  See:
    http://code.google.com/p/nascomaslib

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

效果:

來源:閃吧 作者:qinz 

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()

1 2