3 Replies Latest reply on Nov 15, 2011 4:56 AM by DaveGallant

    No Filters in AIR for iOS?

    davidgrishaver Level 1

      Using the AIR 3.0 overlay and exporting to iOS from CS5.5.  All is well (super cool actually) however the drop shadow filter is failing to work.  Is fine if I publish as swf or projector.

       

      Any tips?

       

      Thnaks,

      Dave

       

       

      CODE

      __________

       

      import flash.net.SharedObject;

      import flash.filters.DropShadowFilter;

       

       

       

       

      var path = MovieClip(this.root).main;

      var gap:Number = 20;

      var hostName:String = "theHost";

      var username:String;

      var fadeBackAmount:Number = .4;

       

       

      var myFont = new ExpoDFont();

      var myFormat:TextFormat = new TextFormat();

      myFormat.size = 15;

      myFormat.align = TextFormatAlign.CENTER;

      myFormat.bold = true;

      myFormat.font = myFont.fontName;

       

       

      doneBut.addEventListener(MouseEvent.CLICK, finishedEditing);

       

       

      /*saveBut.addEventListener(MouseEvent.CLICK, saveIt);

      clearBut.addEventListener(MouseEvent.CLICK, clearIt);

      loadBut.addEventListener(MouseEvent.CLICK, loadIt);

       

       

      saveBut.buttonMode = true;

      clearBut.buttonMode = true;

      loadBut.buttonMode = true;*/

       

       

      var dropShadow:DropShadowFilter = new DropShadowFilter();

      dropShadow.distance = 0;

      dropShadow.angle = 45;

      dropShadow.color = 0x333333;

      dropShadow.alpha = 1;

      dropShadow.blurX = 10;

      dropShadow.blurY = 10;

      dropShadow.strength = 2;

      dropShadow.quality = 15;

      dropShadow.inner = false;

      dropShadow.knockout = false;

      dropShadow.hideObject = false;

       

       

      makeThumbs();

      function makeThumbs() {

       

       

                for (var i:uint=0; i<path.pagesFlow1.length; i++) {

                          var th = new MovieClip();

                          var bitmap:Bitmap = new Bitmap();

                          var mc = new(path.pagesFlow1[i]);

                          var bData:BitmapData = new BitmapData(1024,768);

                          th.tBmap = bitmap;

                          bData.draw( mc );

                          bitmap.bitmapData = bData;

                          bitmap.filters = new Array(dropShadow);

       

       

                          th.addChild(bitmap);

                          th.scaleX = .1;

                          th.scaleY = th.scaleX;

                          th.x = th.width * i + gap * i;

                          th.buttonMode = true;

                          th.name = getQualifiedClassName((path.pagesFlow1[i]));

       

       

                          var myText:TextField = new TextField();

                          myText.defaultTextFormat = myFormat;

                          myText.text = th.name;

                          myText.selectable = false;

                          myText.mouseEnabled = false;

                          myText.wordWrap = true;

                          myText.textColor = 0xCCCCCC;

                          //myText.scaleX = 1;

                          //myText.scaleY = myText.scaleX;

                          myText.width = th.width;

                          myText.height = 40;

                          myText.x = th.width * i + gap * i;

                          myText.y = th.y + th.height / 4;

       

                          addChild(th);

                          addChild(myText);

       

       

                          th.addEventListener(MouseEvent.CLICK,doThumbClick);

       

       

                          if (isThumbExcluded(th)) {

                                    bitmap.alpha = fadeBackAmount;

                                    path.excludePages.push(th.name);

                          } else {

                                    bitmap.alpha = 1;

                          }

                }

      }

       

       

      //test to see if thumb is already excluded

      function isThumbExcluded(t) {

                var mySo:SharedObject = SharedObject.getLocal(hostName);

                for (var prop in mySo.data.soExcludedArray) {

                          if (mySo.data.soExcludedArray[prop] == t.name) {

                                    //trace(" mySo.data.soExcludedArray[prop] "+mySo.data.soExcludedArray[prop]);

                                    return true;

                          }

                }

      }

       

       

       

       

      function doThumbClick(e:MouseEvent) {

                //trace(e.currentTarget.name);

                //if already excluded, let it back in else exclude it

                if (isThumbExcluded(e.currentTarget)) {

                          //trace("e.currentTarget "+e.currentTarget.name);

                          e.currentTarget.tBmap.alpha = 1;

                          //e.currentTarget.isExcluded = false;

                          spliceExcluded(e.currentTarget);

                } else {

                          e.currentTarget.tBmap.alpha = fadeBackAmount;

                          //e.currentTarget.isExcluded = true;

                          path.excludePages.push(e.currentTarget.name);

                }

                saveIt();

      }

       

       

       

       

      function spliceExcluded(t) {

                for (var i:uint=0; i<path.pagesFlow1.length; i++) {

                          if (path.excludePages[i] == t.name) {

                                    //trace("zapped "+path.excludePages[i]);

                                    path.excludePages.splice(i,1);

                          }

                }

      }

       

       

      function finishedEditing(e:Event):void {

                hideMenu();

                MovieClip(this.parent).menu_mc.visible = false;

      }

       

       

      function hideMenu() {

                this.visible = false;

                path.menu.visible = false;

      }

       

       

      ///////SharedOpject Helpers

      function saveIt() {

                var mySo:SharedObject = SharedObject.getLocal(hostName);

                var theExcluded:Array = path.excludePages;

                //trace("theExcluded "+theExcluded);

                mySo.data.soExcludedArray = theExcluded;

                trace("set: " + mySo.data.soExcludedArray);// theExcluded

      }

      //readout.appendText("set: " + mySo.data.soExcludedArray +"\n");

       

       

      function clearIt(e:MouseEvent) {

                var mySo:SharedObject = SharedObject.getLocal(hostName);

                mySo.clear();

      }

       

       

      function loadIt(e:MouseEvent) {

                var mySo:SharedObject = SharedObject.getLocal(hostName);

                //trace(mySo.data.soExcludedArray);// yourUsername

                for (var prop in mySo.data.soExcludedArray) {

                          trace(prop+": "+mySo.data.soExcludedArray[prop]);

                          trace("path.excludePages[prop] "+path.excludePages[prop]);

                }

      }

      //readout.appendText(mySo.data.soExcludedArray[prop] +"\n");

       

       

       

       

      function SharedObject_clear() {

                var mySo:SharedObject = SharedObject.getLocal(hostName);

                var theExcluded:Array = path.excludePages;

                mySo.clear();

      }//trace("cleared: " + mySo.data.soExcludedArray);// undefined