3a變37~~~

ActionScript3.0 2010/05/30 19:14

小翁 說:
 我用test的也正常
 但~~~我在我本機測試trace出來的是undefined
 Allenliao...3.0...~噹噹人 說:
 我用TEST是OK的,但監控軟體還是會出現3A
 小翁你不要TRACE特定變數,你把整個REQUEST都TRACE出來
小翁 說:
 找到問題了~~~
 等一下~~~看錯了
 我再看一下
 Allenliao...3.0...~噹噹人 說:
 http://allenliao.brinkster.net/temp/shit.png
 OK
 那支UPLOAD.PHP的程式可以傳給我看一下嗎?
嘉祥 詹 說:
 我成功上傳了
小翁 說:
 是不是改好了呀
 我這邊監測也正常了
 Allenliao...3.0...~噹噹人 說:
 37
ret=1&img=imgs/21FB916D-6B05-8022-59C9-25CD2BD9D320.jpg
0

嘉祥 詹 說:
 我把php檔案 用 mac 打開
 另存成 utf-8 not bom
 在請阿程丟上去就好
 Allenliao...3.0...~噹噹人 說:
 3a變37了
嘉祥 詹 說:
 有這種是....
小翁 說:
 編碼問題

top

Trackback Address :: http://diary.tw/allenliao/trackback/881

  1. Timothy 2010/06/01 14:42 MODIFY/DELETE REPLY

    還好不會變3小耶....

  2. uggs australia 2011/10/18 04:00 MODIFY/DELETE REPLY

    Shop for UGG Australia Boots at Uggaustralias.net with FREE Shipping

  3. Cheap Air Jordans 2011/10/26 02:40 MODIFY/DELETE REPLY

    [url=http://www.ajcoolgrey.com/]Jordan Shoes[/url],a particular brand which have always stay in the cutting edge sneaker world and dominated the sneaker industry for long time.They casue wide attention and high reputation to people all over the world.This brand of shoes is very fashion.
    The [url=http://www.ajcoolgrey.com/]Cheap Air Jordans[/url],no matter is in the basketball court or in the noisy street or on the formal party,it will always make you become the most shining star in regard of any matches.The of the shoe was covered with nubuck leather while the toe cap was featured with remarakable accent patent leather which not only durable but also vivid and fresh. Many [url=http://www.ajcoolgrey.com/]Jordan Shoes For Sale[/url] on our website.Come to pick your favorite up.

  4. Cheap Air Jordans 2011/10/26 02:41 MODIFY/DELETE REPLY

    <a href="http://www.ajcoolgrey.com/">Jordan Shoes</a>,a particular brand which have always stay in the cutting edge sneaker world and dominated the sneaker industry for long time.They casue wide attention and high reputation to people all over the world.This brand of shoes is very fashion.
    The <a href="http://www.ajcoolgrey.com/">Cheap Air Jordans</a>,no matter is in the basketball court or in the noisy street or on the formal party,it will always make you become the most shining star in regard of any matches.The of the shoe was covered with nubuck leather while the toe cap was featured with remarakable accent patent leather which not only durable but also vivid and fresh. Many <a href="http://www.ajcoolgrey.com/">Jordan Shoes For Sale</a> on our website.Come to pick your favorite up.

  5. ken griff shoes 2011/11/30 09:43 MODIFY/DELETE REPLY

    This article is impressive,I hope that you will continue doing nice article like this

  6. air jordan shoes 2011/11/30 09:44 MODIFY/DELETE REPLY

    Thanks for sharing so significative article with us.

  7. ken griff shoes 2011/11/30 09:45 MODIFY/DELETE REPLY

    This article is impressive,I hope that you will continue doing nice article like this.

Write a comment


AS3 音量~當載體被移除場景

ActionScript3.0 2010/02/01 11:23
當載體被移除場景的時候(用LOADER 在LOAD一次)這裡是被覆蓋掉了,可是裡頭的聲音其實還在跑,我猜是因為聲音再撥放時有做一些EVENT的REFERENCE,如此一來GC並不會回收聲音的物件,只是物件從display List中被移除掉了

這時候!小派(一個好朋友)點醒了我~叫我偵測removed_from_stage 的事件,當載體被移除display List中,就把自己裡頭的聲音關掉!

COOL~

再補充一點
我們常會把聲音遷入影隔中,然後配合動畫演出,之前有遇到不知道為什麼,動畫和聲音嵌在同一個MC裡,在下gotoAndPlay gotoAndStop去控制,聲音有時後會像發了瘋一樣重複播放,後來解決方法是,把聲音對照影格再拉一個MC出來專門忙放聲音,動畫的MC在要撥聲音的影閣中下相對應的gotoAndPlay 去控制聲音的MC,雖然這種做法要維護2個地方的影隔,但開關聲音的程式就好寫多了




top
TAG AS3.0, sound

Trackback Address :: http://diary.tw/allenliao/trackback/861

Write a comment


crossdomain.xml 沒有被自動載入

ActionScript3.0 2010/02/01 08:50
在LOAD的時候加一下new LoaderContext(true),因為預設值是FALSE,妳要設成TRUE crossdomain.xml 才會被載入

var myLoader=new Loader();
 var requestor : URLRequest = new URLRequest(picPath);
 myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaderCompleteHandler);
 myLoader.load(requestor,new LoaderContext(true))
top

Trackback Address :: http://diary.tw/allenliao/trackback/860

Write a comment


關於AS3的trace 走訪OBJECT

ActionScript3.0 2009/11/30 08:09
1.用這個
http://blog.bodurov.com/ActionScript-3-Object-Tracer-for-Flash-and-Flex

2.用mx.utils.ObjectUtil.toString

3.用flash.utils.describeType

以上~~~~~~
top
TAG tracer

Trackback Address :: http://diary.tw/allenliao/trackback/845

  1. ugg australia 2011/10/18 04:00 MODIFY/DELETE REPLY

    Shop for UGG Australia Boots at Uggaustralias.net with FREE Shipping

  2. Cheap Air Jordans 2011/10/26 02:45 MODIFY/DELETE REPLY

    <a href="http://www.ajcoolgrey.com/">Jordan Shoes</a>,a particular brand which have always stay in the cutting edge sneaker world and dominated the sneaker industry for long time.They casue wide attention and high reputation to people all over the world.This brand of shoes is very fashion.
    The <a href="http://www.ajcoolgrey.com/">Cheap Air Jordans</a>,no matter is in the basketball court or in the noisy street or on the formal party,it will always make you become the most shining star in regard of any matches.The of the shoe was covered with nubuck leather while the toe cap was featured with remarakable accent patent leather which not only durable but also vivid and fresh. Many <a href="http://www.ajcoolgrey.com/">Jordan Shoes For Sale</a> on our website.Come to pick your favorite up.

Write a comment


AS3的音量控制

ActionScript3.0 2009/10/04 13:44
someSpriteOrMovieClass.soundTransform = new SoundTransform(0);
這一行可以控制someSpriteOrMovieClass理頭的音量,不會搞到全域影響

下面這一段才是全域音量的控制方法
var tmpSndTrans:SoundTransform=SoundMixer.soundTransform;
   tmpSndTrans.volume=0;
   SoundMixer.soundTransform=tmpSndTrans;
top

Trackback Address :: http://diary.tw/allenliao/trackback/839

  1. Rex 2009/12/27 11:26 MODIFY/DELETE REPLY

    阿倫前輩 可否請教一下

    如果我在場景裡有三個做成元件的音樂

    我要讓他們在一開始就播放

    但是要三首歌的音量都為0

    這能做得到嗎? 該如何寫語法呢?

    懇請賜教了qq 感謝大大

    • allenliao 2010/01/28 02:24 MODIFY/DELETE

      你的元件.soundTransform = new SoundTransform(你要設的音量0[無聲]~1[最大聲]);

  2. true religion jeans 2011/10/18 04:01 MODIFY/DELETE REPLY

    true religion jeans outlet where you can buy discount true religion jeans online with worldwide free shipping

Write a comment


引用:AIR Express Install Badge在线安装出错及解决方法

ActionScript3.0 2009/05/07 03:37
http://ilinker.javaeye.com/blog/309719 不知道有沒有本地自動安裝的解決方案
top
TAG AIR

Trackback Address :: http://diary.tw/allenliao/trackback/762

  1. 忍太郎 2009/05/07 05:30 MODIFY/DELETE REPLY

    這沙小

Write a comment


AS3 load AS2 Aand edit(crossScripting?)

ActionScript3.0 2007/10/04 02:45

首先在domain1.com放置一個由AS3編寫的main.swf
再第一影格程式碼如下

var loader3:Loader=new Loader();//載AS2 SWF
var URLrequest3:URLRequest=new URLRequest("
http://domain2.com/AS2movie.swf");
loader3.contentLoaderInfo.addEventListener(Event.COMPLETE,gotit);
//loader2.load(URLrequest2, new LoaderContext(true,null,null))
loader3.load(URLrequest3);
loader3.y=200;
this.addChild(loader3);
function gotit(e:Event) {
 trace("AD TYPE:"+e.target.contentType);
 trace("e.target:"+e.target.content)
 var w:Number=100;
 var h:Number=100;
 e.target.content.width=w;
 e.target.content.height=h;
 /*
 if (e.target.contentType=="application/x-shockwave-flash" ) {
  var ADP_obj:Object=new Object();
  ADP_obj.w=w;
  ADP_obj.h=h;
  conn.send("setAD_conn", "setADProperty_fun", ADP_obj);
 } else {
  e.target.content.width=w;
  e.target.content.height=h;
  loader.visible=true;
 }*/
}


在domain2.com放置一個由AS2編寫的AS2movie.swf再第一影格程式碼如下

System.security.allowDomain("*");
/*
var conn:LocalConnection = new LocalConnection();
conn.allowDomain = function(sendingDomain:String) {
 trace("sendingDomain:"+sendingDomain)
    return true;
};
conn.Stageobj=this
conn.setADProperty_fun = function(ADP_obj:Object) {
 trace("someone call me!!!")
    this.Stageobj._width=ADP_obj.w
 this.Stageobj._height=ADP_obj.h
};
conn.connect("setAD_conn");
*/

結果我收到下列的錯誤訊息
SecurityError: Error #2121: Sandbox 安全性違規:LoaderInfo.content:http://domain1.com/main.swf 無法存取 http://domain2.com/AS2movie.swf。這問題可以藉呼叫 Security.allowDomain 解決。
 at flash.display::LoaderInfo/get content()
 at loadpic_fla::MainTimeline/gotit()





 

top

Trackback Address :: http://diary.tw/allenliao/trackback/314

Write a comment


AS3 安全性測試-雜記

ActionScript3.0 2007/10/02 07:40
測式範例說明:
從A.com載Q.JPG及Q.SWF回B.COM
下載完成後
你企圖用Event.target.content.width去改變大小,Q.SWF會有安全性限制的警告
Q.JPG任人宰割(前提是A.com/crossdomain.xml要allow B.COM)

結論:
LOAD SWF 和 JPG(不做編輯存取)是沒有限制的,怎麼LOAD都可以!

a.LOAD圖片後編輯只要圖片的機器crossdomain.xml有allow 就OK
b.LOAD SWF後編輯SWF的機器有沒有crossdomain.xml都沒差,但被編輯的SWF需要下System.Security.allowDomain("*")
c.LOAD XML或存取像ASP這種SERVER SCRIPT 需要文件上的機器crossdomain.xml有allow 方可存取
d.不同DOMAIN的SWF要使用 LocalConnection,偵聽的SWF需要使用 LocalConnection.allowDomain() 方法,授予 傳送的SWF 傳送的權限,

觀念:
來自網際網路的資源 (包括 SWF 檔) 分類置入不同的安全執行程序中,這些程序會分別對應於這些資源之來源網站的原始網域>>也就是說一個網域一個安全執行程序(
sandbox)


參考:

  • You can load content from any accessible source. (除了文件隨你怎麼LOAD都可以)
  • Loading is not allowed if the calling SWF file is in a network sandbox and the file to be loaded is local.(網路上的SWF不可以LOAD LOCAL端的檔案)
  • If the loaded content is a SWF file, it cannot be scripted by a SWF file in another security sandbox unless that cross-scripting arrangement was approved through a call to the Security.allowDomain() method in the loaded content file. .(LOAD 外部DOMAIN的SWF檔案時,被LOAD的SWF檔不能被LOAD他的SWF控制(改大小、呼叫變數函數等等),除非被LOAD的SWF有呼叫Security.allowDomain() 這行指令來允許cross-scripting)
  • SWF files written in ActionScript 1.0 or 2.0, which are loaded as AVM1Movie objects, cannot cross-script SWF files written in ActionScript 3.0, which are loaded as Sprite or MovieClip objects. You can use the LocalConnection class to have these files communicate with each other. (若被LOAD的SWF是用AS2或AS1寫的,則無法cross-scripting,若要溝通需靠LocalConnection 才能完成)
  • If the loaded content is an image, its data cannot be accessed by a SWF file outside of the security sandbox, unless the domain of that SWF file was included a cross-domain policy file at the origin domain of the image. (若LOAD 外部DOMAIN的圖片檔案,而想存取該圖片的資訊(EX:做遮罩)除非該圖的機器的crossdomain.xml allow LOAD檔的SWF的DOMAIN)
  • Movie clips in the local-with-file-system sandbox cannot cross-script movie clips in the local-with-networking sandbox, and the reverse is also prevented.
  • You can prevent a SWF file from using this method by setting the allowNetworking parameter of the the object and embed tags in the HTML page that contains the SWF content.
  • 對位於不同安全執行程序中的 SWF 檔,偵聽程式必須使用 LocalConnection.allowDomain() 方法,授予傳送者權限。您傳遞做為 LocalConnection.allowDomain() 方法之引數的字串可以包含下列任何項目:精確的網域名稱、IP 位址,以及 * 萬用字元。

     

  • top

    Trackback Address :: http://diary.tw/allenliao/trackback/313

    Write a comment


    AS3.0 筆記重點11-20項

    ActionScript3.0 2007/09/21 12:42
    11.使用AS3的XML元件取得一個XML TAG的值時,和沒有定義的判斷方法
    import flash.net.*;
    import flash.events.*;
    var URLstr:String="http://mydomain.com/myxml.xml";
    var myXML:XML=new XML();
    var myLoader:URLLoader=new URLLoader();
    var myRequest:URLRequest=new URLRequest(URLstr);
    myLoader.addEventListener(Event.COMPLETE,XMLinit);
    myLoader.load(myRequest);
    function XMLinit(e:Event):void {
     var myLoader:URLLoader=URLLoader(e.target);
     myXML=XML(myLoader.data);
     trace(myXML.adFilePath=="");//TAG中沒有值傳回true
     trace(myXML.adFilePath222==undefined);//不存在的TAG傳回true
    }

    12.執行sound.play()會RETURNㄧ個SoundChannel物件[具有stop() 方法、監視聲道振幅 (讀取音量) 的屬性,以及將 SoundTransform 物件(設定音量)設定為聲道的屬性]

    13.在CS3中已沒有ReleaseOutSide這個事件了,而我們在CS3使用startDrag()做拖曳效果時還是會遇到ReleaseOutSide的問題,下列程式碼可以解決這個問題,模擬使用ReleaseOutSide這個事件

    btn.addEventListener(MouseEvent.MOUSE_DOWN,btn_Down);
    function btn_Down(e:MouseEvent):void {
     btn.startDrag(false,new Rectangle(100, 100, 100, 100));
     btn.stage.addEventListener(MouseEvent.MOUSE_UP,btn_Up);
    }//把MOUSE_UP這個事件註冊再btn的stage上面是這個技巧的重點
    function btn_Up(e:MouseEvent):void {
      btn.stage.removeEventListener(MouseEvent.MOUSE_UP,btn_Up);
      btn.stopDrag();
    }

    14.AS3的attachMovie
    用這個~import flash.utils.getDefinitionByName;
    像醬:getDefinitionByName(id.toString());//回傳class,記得NEW起來才可以用

    15.Bitmap才可以被addChild因為BitmapData不是繼承DisplayObject,所以從元件褲動態抓過來的JPG(非MC)要再包一層Bitmap
    像醬:new Bitmap(new BitmapData(width,height),PixelSnapping.AUTO,true);

    16.AS3改顏色
    var colorTransform:ColorTransform = square.transform.colorTransform;
    colorTransform.color = 0xFF0000;
    square.transform.colorTransform = colorTransform;

    17.localToGlobal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    //sMenu裡頭包很多myBtn 這段語法將會把myBtn.x轉換成"sMenu的PARENT"上的場景座標
     var clickPoint:Point = new Point(myBtn.x, myBtn.y);
     var targetPoint=sMenu.localToGlobal(clickPoint);


    top
    TAG sound, XML

    Trackback Address :: http://diary.tw/allenliao/trackback/306

    1. allenliao 2007/09/21 12:43 MODIFY/DELETE REPLY

      test

    Write a comment


    AS3.0 筆記重點1-10項

    ActionScript3.0 2007/09/11 08:30
    1.null和undefined的差別在於
    null是指沒有值
    undefined是宣告未完全、沒有宣告這個屬性或沒有指定資料型態(未賦予值沒做過資料轉型也算)
    null==undefined但null!==undefined
    所以我們常常要檢查外部變數有沒有被賦予值要用

    if(外部變數==null){
      外部變數沒有被賦予值
    }

    2.把變數宣告在所有程式(FUNCTION)的最上面

    3.執行container.addChild(ball_A);時,若container已存在ball_A這個物件,在執行1次的功能在於,PLAYER會把原有的ball_A刪掉,再重新加入ball_A,所以ball_A顯示的順序就會變成在最上面,若你要指定顯示順序就用container.addChildAt(ball_A, 1);這個指令(0-N),0為最底層N為目前最上面ㄧ層

    4.自動管理顯示順序
    trace(container.getChildAt(0).name); // ball_A
    trace(container.getChildAt(1).name); // ball_C
    trace(container.getChildAt(2).name); // ball_B
    container.removeChild(ball_C);
    trace(container.getChildAt(0).name); // ball_A
    trace(container.getChildAt(1).name); // ball_B

    5.delete 才會完整的把物件殺掉removeChild只是移除顯示清單而已,ㄧ個物件只能對應一個container

    6.其他好用的函式
    • contains(): Determines whether a display object is a child of a DisplayObjectContainer.
    • getChildByName(): Retrieves a display object by name.
    • getChildIndex(): Returns the index position of a display object.
    • setChildIndex(): Changes the position of a child display object.
    • swapChildren(): Swaps the front-to-back order of two display objects.
    • swapChildrenAt(): Swaps the front-to-back order of two display objects, specified by their index values.

    7.取代AS 2.0 用[]動態命名的方法
    import flash.display.Sprite;
    var container1:Sprite = new Sprite();
    container1.name="allen";
    container1.x=20;
    var container2:Sprite = new Sprite();
    container2.addChild(container1);
    addChild(container2);
    trace(container2.getChildByName("allen").x);
    沒錯就是這一行container1.name="allen";直接指定name


    8.AS2.0時我們用_xscale=150就會把寬放大1.5倍現在用scaleX時要寫成scaleX=1.5才能達成同樣的效果,scaleY也ㄧ樣而 alpha 的範圍只接受 0 (fully transparent) to 1 (fully opaque).

    9.FLV加全螢幕功能時記得設
    video.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO
    video.align = VideoAlign.CENTER
    這2個屬性影片被放大才不會變形且置中

    10.假設場景上有一個instance:btns你註冊了btns這個MC CLICK的功能而btns這個MC內包有許多MC(縱使沒有指定instance name),當你下btns.mouseEnable=false時,若你點到btns裡頭的MC覆蓋的範圍,btns.mouseEnable=false會沒作用,這時你需要btns.mouseChildren=false才會達到你所想像的效果













    top

    Trackback Address :: http://diary.tw/allenliao/trackback/300

    Write a comment