BlurFilter

I tried to blur the lines. But it does not work... Help, please
Just copy paste code on the first following image and test it. Otherwise, you can download here.

Code:



import flash.filters.BlurFilter;
var blurX:Number = 40;
var blurY:Number = 40;
var quality: Number = 5;
filter: var BlurFilter = new BlurFilter (blurX, blurY, quality);
var filterArray:Array = new Array();
filterArray.push (filter);
m.filters = filtersArr;
//=========================
myLines.filters = filterArray;
this.createEmptyMovieClip ("myLines", this.getNextHighestDepth ());
drawLine() {} function
myLines.lineStyle (5, 0xff0000, 100);
myLines.beginFill (0xff0000);
myLines.moveTo (ix, iy);
myLines.lineTo (ix + iy 6, + 6);
myLines.lineTo (ex + ey 6 + 6);
myLines.lineTo (ex, ey);
myLines.filters = filtersArr;
}
var ix, iy, ex, ey, keepDraw;
onMouseDown = function () {}
IX = _xmouse;
IY = _ymouse;
keepDraw = setInterval (function () {}
ex = _xmouse;
EY = _ymouse;
drawLine();
IX = ex;
IY = ey;
(}, 10);
};
onMouseUp = function () {}
clearInterval (keepDraw);
};
Assign the filters array to the filters property
DELIMIMAGE in the order in which the filters will be
applied.


Thank you very much.. I was really very much puzzled...

Thanks again.

Amit

Tags: Adobe Animate

Similar Questions

  • Add Filter button grey

    I'm Objectville animation and I need to blur things like a mountain in the background and the shadows. I use Flash CC 2015 and I'm out this December. Thank you.

    I suggest you use GreenSock | TweenMax library.

    import com.greensock;

    com.greensock.easing import. *;

    TweenMax.to (mc, 1, {blurFilter: {blurX:20, blurY:20}});}})

  • Dynamically loaded Bitmapdatas zip are not approved locally and therefore cannot be changed

    It is a very strange problem.

    I use external resources to a game that I do. One of the resources is a zip file containing 100 images (thumbnails). The goal of this zip is simply that he would load these resources much easier, simpler and as I am storing these resources on Amazon S3, significantly cheaper.

    He worked without a hitch, until I moved and ran the swf in a location not approved.

    Now, when I try to load the first thumbnail I get this:

    Charger/get content())

    SecurityError: Error #2148: SWF file file:///C|/Users/Tom/Desktop/Jigsaw.swf cannot access the resource local file:///C|/Users/Tom/Desktop/Jigsaw.swf/[[DYNAMIC]]/1. Only SWF files local local - with system files and trust can access local resources.

    This happens when I try and access Loader.content, I need to do what some bitmapdatas will have to be changed after loading.

    I ran into a similar error when you try to originally load external resources and convert them into bitmapDatas. This has been fixed by using a policy file.

    I thought the policy file was the problem, but then I tried to integrate the .zip in the swf file rather than load it externally, like this:

    [Embed (source = "... / res/images/thumbnails.zip", mimeType = "application/octet-stream" "")]

    But even that threw up the same error.

    What is happening is that a byteArray is skillfully transposed in a BitmapData, but in the process, it becomes not approved by Flash.

    I can't find any way to convert this byte.

    I tried using several different class zip as3 packages, but they all fall into the same obstacle.

    Here's the key code:

    zip: FZip var = new FZip();

    zip.loadBytes (zipData);

    var file:FZipFile = zip.getFileByName ("image1.jpg");

    var loader: Loader = new Loader();

    loader.loadBytes (file.content);

    root.addChild (loader);

    loader.addEventListener ("click", Function {}

    var bd:BitmapData = e.target.content.bitmapData;

    bd.applyFilter (bd, bd.rect, new focus(), new BlurFilter (20, 20, 1));

    } );

    This is the part that is really weird... When I test it, it works fine, when I download online, very well. The only time I get the error is when the SWF file is run locally, but in an untrusted location.

    Obviously, these security measures are a bit blurry if it works without a hitch in line, but does not on-site, expect that it is the other way around.

    As far as I know there's nothing potentially dangerous with my code. It is from a trusted location (the policy file works).

    I found another unfortunate person who encountered the same problem, but never got a response:

    http://www.ActionScript.org/forums/showthread.php3?t=261853

    I've tried EVERYTHING. bitmapdatas loaded dynamically zippers are unmodifiable without apparent reason... unless the swf is opened in a trusted location or anywhere online.

    If you want your trusted local files, it adds trust files setting: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.htm l

  • Is it possible to load a URL on stage?

    Hello

    I use CC - Action Script 3 Flash, is it possible to load a URL on the stage?

    use:

    import flash.events.MouseEvent;

    import flash.text.TextField;

    import flash.text.Font;

    import flash.text.TextFormat;

    import flash.display.Sprite;

    import flash.text. *;

    import flash.filters.BitmapFilter;

    import flash.filters.BitmapFilterQuality;

    import flash.filters.BlurFilter;

    Import 12345678910111213import;

    import flash.display.Loader;

    import flash.net.URLRequest;

    var link: URLRequest = new URLRequest ("http://simplegreen.com/");

    ADD CONTAINERS

    var containerStage: Sprite = new Sprite();

    containerStage.tabChildren = false;

    stage.addChild (containerStage);

    DATE TIMER

    var my_date: Date;

    var mon_timer: Timer = new Timer (1000); create a new timer that everysecond ticks

    var dateStyle: TextFormat = new TextFormat;

    dateStyle.color = 0xFFFFFF;

    dateStyle.size = 48;

    dateStyle.font = "myriadMm;

    dateStyle.align = 'left ';

    var myDateTextBox: TextField = new TextField;

    myDateTextBox = new TextField();

    myDateTextBox.width = 600;

    myDateTextBox.x = 70;

    myDateTextBox.y = 70;

    myDateTextBox.setTextFormat (dateStyle);

    Add to the scene;

    containerStage.addChild (myDateTextBox);

    var myTimeTextBox: TextField = new TextField;

    myTimeTextBox = new TextField();

    myTimeTextBox.width = 600;

    myTimeTextBox.x = 70;

    myTimeTextBox.y = 117;

    myTimeTextBox.setTextFormat (dateStyle);

    Add to the scene;

    containerStage.addChild (myTimeTextBox);

    my_timer.addEventListener (TimerEvent.TIMER, onTimer);

    my_timer. Start();

    MONTH AND DATE

    var months: Array = ['Jan', 'Feb', 'Mar', 'Apr', 'may', 'June', 'Jul', 'Aug', 'Seven', "Oct", "Nov", "Dec"];

    days var: Array = ["Sun", "Read", "Ma", "Wed", "Game", "Fri"];

    Text charger

    var textLoader: URLLoader = new URLLoader();

    textLoader.addEventListener (Event.COMPLETE, textLoaded);

    textLoader.load (new URLRequest("assets/phoneList.txt"));

    var ampm: String = new String();

    function onTimer (e: TimerEvent): void {}

    my_date = new Date();

    myDateTextBox.text = days [my_date.day] + "," + "" + months [my_date.month] + "" + formatF (my_date.date) + "" + my_date.fullYear;

    If (my_date.hours< 12)="">

    AMPM = "AM";

    } else {}

    AMPM = 'H ';

    }

    var hours: int = my_date.hours;

    If {(heures > 12)}

    hours-= 12;

    }

    myTimeTextBox.text = formatF (hours) + ":" + formatF (my_date.minutes) + "" + ampm.

    }

    function formatF(n:int):String {}

    var s:String = n.toString ();

    While (s.length<>

    s = « 0 » + s ;

    }

    return s;

    }

    Event listeners

    phone.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

    function fl_ClickToGoToAndPlayFromFrame(event: MouseEvent): void {}

    trace ("ready directory');

    }

    simpleGreen.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);

    function fl_ClickToGoToAndPlayFromFrame_2(event: MouseEvent): void {}

    navigateToURL (link, "_self");

    }

    videoDirectory.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);

    function fl_ClickToGoToAndPlayFromFrame_3(event: MouseEvent): void {}

    trace ("Video Player is ready");

    }

    function textLoaded(evt: Event): void {}

    info_txt.htmlText = textLoader.data;

    }

  • Filter Blur + mask

    I think that a few people asked about this problem, but none of them seemed to have an answer so I'm re-posting.

    It is thus the blur filter and mask to work in the code

    var blur: BlurFilter = new BlurFilter();

    blur.blurX = 10;

    blur.blurY = 10;

    mask of the var: Bitmap = new Bitmap (...)

    var shape: Shape = new Shape();

    shape.graphics.beginFill (color, alpha);

    shape.graphics.moveTo (100, 100);

    shape.graphics.lineTo (...);

    shape.graphics.endFill ();

    Shape.filters = [blur]

    Shape.mask = mask;

    bitmap.bitmapData.draw (shape);

    But the result is not what I want. Please see the image below:

    blur_mask.JPG

    Do an another pixel bitmap and copy using the mask works but it makes any application very slow.

    How can I hide blur filter using a simple draw?

    The difference between the code I posted, and what you have here, is that you apply the mask and blur to form, while I applied the blur to the shape and the mask to a container of the form is inside. It is because for a given object, filters are applied AFTER all masking, but you want the opposite. The only way to control the order in which I don't know if it is to create more layers.

    In other words, change the last code you have posted like this:

    1. create a container for the form:

    var container:Sprite = new Sprite();
    

    2 Add the shape to the container:

    container.addChild(shape);
    

    3. apply the blur on the form and the mask to the container:

    shape.filters = [blur];
    container.mask = block;
    

    3 trace the container for the bitmap:

    bitmap.bitmapData.draw(container);
    

    To produce the image you want.

    -Aaron

  • Tween problem?

    I am loading images dynamically and tries to get them to interpolation, but it does not work as expected (or the way in which it should be)

    Once Ive named the movieclip empty and load the film, he appears on stage. I have a defined interval and then activate the interpolations. The problem is that one of them active (and the last). ID like an animation that would put the image out of the scene in both directions at the same time (diagnal with a bit of rotation if possible).

    Here's the code,

    Import mx.transitions.Tween;

    Import mx.transitions.easing. *;

    import flash.filters.GlowFilter;

    import flash.filters.DropShadowFilter;

    import flash.filters.BlurFilter;

    import flash.filters.BevelFilter

    Stop();

    TopShelf_mc.swapDepths (100);

    this.createEmptyMovieClip ("mcHolder", 1);

    var myLoader:MovieClipLoader = new MovieClipLoader();

    mcHolder._xscale = 85;

    mcHolder._yscale = 85;

    mcHolder._rotation = 3

    mcHolder._x = 15;

    mcHolder._y =-13;

    myLoader.loadClip ("Pool.png", mcHolder);

    mcHolder.forceSmoothing = true;

    var timerone = setInterval (frameOne, 4000)

    function frameOne()

    {

    var on the side: Tween = new Tween (mcHolder, "_x", Strong.easeIn, mcHolder._x, 312, 3, true);

    var updown:Tween = new Tween (mcHolder, "FLF", Strong.easeOut, mcHolder._y, 230, 3, true ");

    clearInterval (timerone);

    }

    Can a created movieclip as I be interpolated ke I want (or I have to go in a code to do)

    Use a manager of of onMotionFinished (applied to your tween) to detect when a Tween completes.  in this handler use setTimeout() to call another function that starts the following interpolation.

  • Place the items in the table next to each other on stage

    Hey guys,.

    I know I have to do something wrong that is easy and simple to fix, but I can't fix.

    I have a table called a frame of a movieclip and I want to place each image as a 'menu' on the stage.

    The problem I have is that I want to put each item in menu next to each other, but the only code I could find work is the 3D carousel.

    So I try to adapt this code to my needs.

    Where I'm going wrong? Any help would be great.

    Code below:

    package classes

    {

    import flash.display.MovieClip;

    com.greensock.*;//for interpolation ability to import

    import com.greensock.TweenLite;

    com.greensock.easing import. *;

    import flash.filters.BlurFilter;

    import flash.events.Event;

    import flash.utils.Timer;

    import flash.events.TimerEvent;

    import flash.display. *;

    import flash.events. *;

    import flash.sampler.StackFrame;

    SerializableAttribute public class extends MovieClip MenuSystem

    {

    private var blur: BlurFilter = new BlurFilter (0,0,1);

    private var holderMc:MovieClip = new MovieClip();

    private var radiusX:uint = 1200; / / width of the carousel

    private var rayonY: uint = 400; / / height of the carousel

    private var centerX:Number = 100; / / x position of the center of the carousel

    private var centerY: Number = 350; / / the position there from the center of the carousel

    private var speed: Number = 0.01; / / initial rotation of the carousel speed

    private var itemArray:Array = new Array(); / / store the items to sort them according to their 'depth' - see the sortBySize() function.

    public var navigationPopupInfo:NavigationPopupInfo = new NavigationPopupInfo();

    public void MenuSystem()

    {

    the constructor code

    We do support for the menu system serve

    addChild (holderMc);

    holderMc.y = - 200;

    Also add a listener to control the rotation of the speed menu

    / * addEventListener (MouseEvent.MOUSE_MOVE, OnMouseMoveHandler);

    */                    }

    public function initNavigationPop (): void

    {

    TweenMax.to (navigationPopupInfo, 0, {alpha: 0, 40-y:, blurFilter: {blurX:3, blurY:10}});}})

    holderMc.addChild (navigationPopupInfo);

    navigationPopupInfo.x = (-navigationPopupInfo.width / 2);

    TweenMax.to (navigationPopupInfo, 2, {delay: 1, alpha: 1, y: 10, ease:Elastic.easeOut});})

    TweenMax.to (navigationPopupInfo, 1, {delay: 1, blurFilter: {blurX:0, blurY:0}});}})

    }

    Place the vital elements on stage

    public void initRange(numOfMenuItems:Number):void

    {

    for (var i: uint = 0; i < numOfMenuItems; i ++)

    {

    var arrayBoxItem:String = ('model' + (i + 1) + '_');

    var itemMc:ItemMc = new ItemMc();

    public var angl:Number; belongs to the class of the element.

    Item class extends ItemInner in the library FLA.

    itemMc.angl = i * (400 / numOfHomeRangeItems);

    itemMc.alpha = 0.8;

    itemMc.name = (arrayBoxItem);

    trace (itemMc.Name);

    holderMc.addChild (itemMc);

    itemArray.push (itemMc);

    itemMc.itemHitter.buttonMode = true;

    itemMc.addEventListener (Event.ENTER_FRAME, enterFrameHandler);

    Listen MouseEvents only on the icons, not on reflection;

    itemMc.itemHitter.addEventListener (MouseEvent.CLICK, clickHandler);

    itemMc.itemHitter.addEventListener (MouseEvent.ROLL_OVER, rollOverHandler);

    itemMc.itemHitter.addEventListener (MouseEvent.ROLL_OUT, rollOutHandler);

    itemMc.iconMc.gotoAndStop (arrayBoxItem);

    }

    }

    public void clickHandler(event:MouseEvent):void

    {

    clean your audience before doing anything else to release

    the user CPU resources

    for (var i: uint = 0; i < itemArray.length; i ++)

    {

    var itemMc:ItemMc = itemArray [i];

    itemMc.removeEventListener (Event.ENTER_FRAME, enterFrameHandler);

    itemMc.itemHitter.removeEventListener (MouseEvent.CLICK, clickHandler);

    itemMc.itemHitter.removeEventListener (MouseEvent.ROLL_OVER, rollOverHandler);

    itemMc.itemHitter.removeEventListener (MouseEvent.ROLL_OUT, rollOutHandler);

    Optional:;

    TweenLite.to (itemMc, 1, {scaleX:0, scaleY: 0, alpha: 0.1, ease:Elastic.easeInOut});})

    TweenMax.to (itemMc, 1, {blurFilter: {blurX:5, blurY:5}});}})

    to replace the carousel again see function reInit()

    FIND A WAY TO REMOVE ITEMS

    this.removeChild (itemMc);

    }

    Tabula Rasa, to prepare variables

    var variantName:String = event.target.parent.name;

    itemArray.splice ();

    If (variantName == "backBtn") {MovieClip (root) .reinitMenuSystem () ;}

    else {MovieClip (root) .addVariantPage (variantName) ;}

    }

    /////////////////////////////////////////////////////////////////////////////// /////////////////////// POSITION ITEMS IN CAROUSEL

    position items in the Menu

    public void enterFrameHandler(event:Event):void

    {

    Event.Target.x = centerX; / / position of the element x

    Event.Target.y = centerY / / position point y of

    Scale according to position point there to give the point of view

    / * var s:Number = event.target.y / (centerY + rayonY);

    event.target.scaleX = event.target.scaleY = s;

    Event.Target.angl += speed; / / speed is updated by OnMouseMoveHandler

    ADD DOF

    blur.blurX = - event.target.y / 10 + 21;

    blur.blurY = - event.target.y / 10 + 21;

    Event.Target.filters = [blur];

    Finally set the size of the elements

    sortBySize();

    */                    }

    /////////////

    Check the progress of ticks

    / / / TRI SIZE DETERMINE DEPTH OF ELEMENTS

    set the display list index (depth) of the elements according to their

    scaleX property so that the element, the index is high (depth)

    / * public function sortBySize (): void

    {

    It is not a property Array.ASCENDING DECLINING use and reverse()

    itemArray.sortOn ("scaleX", Array.DESCENDING |) Array.NUMERIC);

    itemArray.reverse ();

    for (var i: uint = 0; i < itemArray.length; i ++)

    {

    var itemMc:ItemMc = itemArray [i];

    holderMc.setChildIndex (itemMc, i);

    }

    }

    */

    /////////////////////////////////////////////////////////////////////////////// /////////////////////// ITEMS WHEN ROLLOVER & OUT

    public void rollOverHandler(event:MouseEvent):void

    {

    var currentModel:String = event.target.parent.iconMc.parent.name;

    Event.Target.parent.alpha = 1;

    TweenLite.to (event.target.parent.iconMc.tooltipMc, 1, {alpha: 1, y:-40, ease:Elastic.easeOut});})

    event.target.parent.iconMc.tooltipMc.tipHeader.gotoAndStop (currentModel);

    }

    function rollOutHandler(event:MouseEvent):void

    {

    Event.Target.parent.alpha = 0.8;

    TweenLite.to (event.target.parent.iconMc.tooltipMc,.5, {alpha: 0, y:-27});})

    }

    / / / ITEMS IN THE CAROUSEL MOVEMENT ACCORDING TO THE POSITION OF THE MOUSE

    /*

    Update of the speed at which the carousel turns accoring to the distance of the mouse since the center of the stage. The variable speed is only updated when the mouse is over the point Sprites.

    */

    / * function mouseMoveHandler(event:MouseEvent):void public

    {

    Speed = (mouseX - centerX) / 20000;

    }

    */          }

    }

    I have a table called a frame of a movieclip and I want to place each image as a 'menu' on the stage

    This code will take a MovieClip in your library with the link ("Menuitem") that has 5 labeled keyframes "menuitem 1 «...» "" menuitem 5 ', it is adapted accordingly to your stagesize and distribute, and align the elements at the top from left to right:

    I havemport flash.display.MovieClip;

    var menu_Array:Array = new Array();

    the var menu: MovieClip = new MovieClip();

    var stageWidth:int = stage.stageWidth;

    var menuWidth:int = 0;

    for (var i: int = 0; i<5;>

    {

    var menuItem:Menuitem = new Menuitem();

    menuWidth += menuItem.width;

    menu_Array.push (MenuItem);

    }

    function distrbuteAndAlignItems(_menu:MovieClip,_array:Array):void

    {

    var scaleFactor:Number = stageWidth / menuWidth;

    var xAdjustment:Number;

    trace (scaleFactor);

    for (var j: int = 0; j<_array.length;>

    {

    MovieClip(_array[j]).scaleX = MovieClip(_array[j]).scaleY = scaleFactor;

    for (var k: int = 0; k

    {

    xAdjustment += MovieClip(_array[j]).width;

    }

    _ARRAY [j] .x = xAdjustment;

    _ARRAY [j].gotoAndStop(j+1);

    xAdjustment = 0;

    _Menu. AddChild (_ARRAY [j]);

    }

    addChild (_menu);

    }

    distrbuteAndAlignItems (menu, menu_Array);


    If that's what you're looking for...

  • How to debug Error #1009?

    I var for all the mc in a great mc. This var allows me to apply MOUSE_OVER/OFF effect both the mc within the largest and mc.

    Everything works. Only one click that brings a user to another set of pages I have this error (I find it strange because this configuration has nothing to do with a click):

    IntroIMGS_COLLAGE.AppsIntro.addEventListener(MouseEvent.MOUSE_OVER, navOver_ORIGINAL_IntroIMGS_COLLAGE);
    IntroIMGS_COLLAGE.AppsIntro.addEventListener(MouseEvent.MOUSE_OUT, navOut_ORIGINAL_IntroIMGS_COLLAGE);
    
    
    function navOver_ORIGINAL_IntroIMGS_COLLAGE(e:MouseEvent):void
    {
        //loop through all icons
        for (var i in IntroIMGS_COLLAGE.AppsIntro)
            {
            //tween out all icons
            TweenMax.to(IntroIMGS_COLLAGE.AppsIntro[i], .2, {alpha:.85, blurFilter:{blurX:1, blurY:1}, colorMatrixFilter:{colorize:0x000000, amount:0.25, brightness:0.65, saturation:0.7}, ease:Sine.easeOut});
            }
            //target = tween the icon you are over to its normal state
            TweenMax.to(e.target, .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1.25, saturation:1}, ease:Sine.easeOut});
    }
    
    
    function navOut_ORIGINAL_IntroIMGS_COLLAGE(e:MouseEvent):void
    {
        for (var i in IntroIMGS_COLLAGE.AppsIntro)
            {
            //tween out all icons to a normal state
            TweenMax.to(IntroIMGS_COLLAGE.AppsIntro[i], .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1, saturation:1}, ease:Sine.easeOut});
            }
    }
    

    Here is the error message in the output panel:

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    at acolyte68New_OpeningCollage_fla::mainsite_mc_2/navOut_ORIGINAL_IntroIMGS_COLLAGE() [e68New_OpeningCollage_fla.mainsite_mc_2::frame1:1428 acolyt]

    I tested in a way that I replaced "IntroIMGS_COLLAGE. AppsIntro"with"IntroIMGS_COLLAGE"- then it worked.

    All the mc table is inside the "AppsIntro" which is inside the "IntroIMGS_COLLAGE".

    It works in situations more:

    function navOut_ORIGINAL_IntroIMGS_COLLAGE(e:MouseEvent):void
    {

    if(IntrolIMGS_COLLAGE){
        for (var i in IntroIMGS_COLLAGE.AppsIntro)
            {
            //tween out all icons to a normal state
            TweenMax.to(IntroIMGS_COLLAGE.AppsIntro[i], .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1, saturation:1}, ease:Sine.easeOut});
            }


    }

    }

  • The function of MouseWheel support


    Hello

    I'm a newcomer to Flash,

    I'm trying to bind blur and opacity to the intervention of mousewheel.

    I created a custom cursor, I would:

    (1) when the wheel scrolls up to increase opacity to 100% and to reduce the blur to 0

    (2) for the scroll wheel down decrease the opacity to 0 and increase of blur at 100%

    Any help would be appreciated:

    [AS]

    import flash.display.Sprite;

    import flash.display.StageAlign;

    import flash.display.StageScaleMode;

    import flash.events.Event;

    import flash.events.MouseEvent;

    var myCursor:Sprite;

    internship. Align = StageAlign.TOP_LEFT;

    stage.scaleMode = StageScaleMode.NO_SCALE;

    function init()

    {

    Mouse.Hide ();

    This creates an instance of MovieClip library with the

    name, "MyCursorClass".  It contains your mouse cursor art

    //

    myCursor = new MyCursorClass();

    myCursor.mouseEnabled = false;

    myCursor.visible = false;

    you want to make sure that the child is added above all

    elsewhere, perhaps in its own container

    //

    addChild (myCursor);

    respond to the mouse movement events

    stage.addEventListener (MouseEvent.MOUSE_MOVE, OnMouseMoveHandler);

    stage.addEventListener (Event.MOUSE_LEAVE, mouseLeaveHandler);

    }

    function mouseMoveHandler(evt:MouseEvent):void

    {

    whenever the mouse moves the cursor at the same place

    myCursor.visible = true;

    myCursor.x = evt.stageX;

    myCursor.y = evt.stageY;

    }

    function mouseLeaveHandler(evt:Event):void

    {

    myCursor.visible = false;

    }

    init();

    [/ ACE]

    :

    import flash.filters.BlurFilter;

    fix this

    var speed: Number = 1;

    var bf:BlurFilter = new BlurFilter();

    function mouseWheelF(e:MouseEvent) {}

    bf.blurX = bf.blurY = speed * e.delta;

    myCursor.filters = [bf];

    myCursor.alpha += speed * e.delta / 100;

    }

    stage.addEventListener (MouseEvent.MOUSE_WHEEL, mouseWheelF);

  • Flame effect

    Hi all

    I'm do a flame but sweetness & flame course is not correct.

    Please help this weblink

    I don't know if you use AS2 or AS3. But here's an AS2 flame effect. First try by itself and see if you can find a way to use it.

    Or you might like this tutorial here: http://www.powerabuse.co.uk/tutorials/particle_fire.html

    Good luck

    import flash.display.BitmapData;

    import flash.filters.BlurFilter;

    import flash.geom. *;

    var flameWidth:Number = 800

    var flameHeight:Number = 300;

    var seedWidth:Number = 15;

    var blurX:Number = 4;

    var blurY:Number = 8;

    var numSeeds:Number = 15;

    var numPasses:Number = 2;

    var blur: BlurFilter = new BlurFilter (blurX, blurY, 2);

    var bmp0:BitmapData = new BitmapData (flameWidth, flameHeight + blurY * 2, false, 0x0);

    var bmp1:BitmapData = new BitmapData (flameWidth, flameHeight, true, 0xffffffff);

    this.createEmptyMovieClip("img",100);

    this.attachBitmap(bmp0,200);

    img.attachBitmap(bmp1,100);

    IMG._y = Stage.height - flameHeight + (blurY > 1);

    IMG._x = (Stage.width - flameWidth) / 2

    var map: Array = new Array();

    var nullArray:Array = new Array();

    for (var i = 0; i)<256; i++)="">

    map [i] = HSL2RGB (i / 3, 255, Math.min (255, i * 2));

    nullArray [i] = 0;

    }

    onEnterFrame = function() {}

    for (var i = 0; i)

    for (var j = 0; j)

    bmp0.fillRect (new Rectangle (getRandInt(150,flameWidth-150), flameHeight + (blurY > 1), seedWidth, 2), 0xffffff);

    }

    bmp0. ApplyFilter (bmp0, new Rectangle (0, 0, flameWidth, flameHeight + (blurY > 1)), new Point (0, -3), the blur);

    }

    bmp1.paletteMap (bmp0, new Rectangle (0, 0, flameWidth, flameHeight-(blurY >> 1)), new Point (0, 0), map, nullArray, nullArray, null);

    };

    function HSL2RGB (h:Number, sl:Number, l:Number) {}

    var r: Number;

    var g:Number;

    var b:Number;

    h / = 255;

    SL / = 255;

    l / = 255;

    var v: Number = (l<=0.5) (l*(1.0+sl))="" :="">

    If (v<=0)>

    r = g = b = 0;

    } else {}

    var m:Number = l + l - v;

    var sv:Number = (v - m) / v;

    h * = 6;

    var sextant: Number = Math.floor (h);

    var fract:Number = h-sextant;

    var vsf:Number = v * sv * fract;

    var mid1:Number = m + vsf;

    var mid2:Number = v - vsf;

    switch (sextant) {}

    case 0:

    r = v;

    g = mid1;

    b = m;

    break;

    case 1:

    r = mid2;

    g = v;

    b = m;

    break;

    case 2:

    r = m;

    g = v;

    b = mid1;

    break;

    case 3:

    r = m;

    g = mid2;

    b = v;

    break;

    case 4:

    r = mid1;

    g = m;

    b = v;

    break;

    case 5:

    r = v;

    g = m;

    b = mid2;

    break;

    }

    }

    return (((r*255))< 16)="" |="" ((g*255)="">< 8)="" |="">

    }

    function getRandInt(min:Number,_max:Number):Number {}

    var num:Number = Math.floor (Math.random () *(max-min+1)) + min;

    return num;

    }

  • Gallery images will not load when I transfer the files on the server

    The gallery works fine when files on my computer, but when I download files on my server does not load images.

    I use the xml file to load the images. Here is the code of the Gallery:

    function loadPlayList(url:String) {
              delete myMO.onMouseWheel;
              delete myKO.onKeyDown;
              for (var i in infostruc) {
                        root["_ref"+i] = root["_bmd"+i]=false;
              }
              loadedAll = false;
              infostruc = [];
              for (var i in root) {
                        if ((root[i]._name.substr(0, 3) == "art" || root[i]._name.substr(0, 10) == "reflection") && (parseInt(root[i]._name.split("art")[1]) || parseInt(root[i]._name.split("reflection")[1]))) {
                                  root[i].swapDepths(root.getNextHighestDepth());
                                  root[i].removeMovieClip();
                        }
              }
              current = 1;
              root.createEmptyMovieClip("loader", root.getNextHighestDepth());
              xmlData.load(url);
    }
    function init(Void):Void {
              myMO = {};
              myKO = {};
              Mouse.addListener(myMO);
              Key.addListener(myKO);
              for (var i in infostruc) {
                        loader.clear();
                        loader.gradient_mc.removeMovieClip();
                        loader.attachMovie("default", "art", 1);
                        root["_shelveCDWidth"+i] = shelveCDWidth;
                        root["_shelveCDHeight"+i] = shelveCDHeight;
                        root["_frontCDWidth"+i] = frontCDWidth;
                        root["_frontCDHeight"+i] = frontCDHeight;
                        this["_bmd"+i] = new BitmapData(loader._width, loader._height);
                        this["_ref"+i] = new BitmapData(loader._width, loader._height);
                        this["_bmd"+i].draw(loader);
                        var mc:MovieClip = loader.createEmptyMovieClip("gradient_mc", loader.getNextHighestDepth());
                        matrix = new Matrix();
                        matrix.createGradientBox(loader._width, loader._height, reflectionRotation/180*Math.PI, 0, 0);
                        mc.beginGradientFill(reflectionFillType, reflectionColors, reflectionAlphas, reflectionRatios, matrix, reflectionSpreadMethod, reflectionInterpolationMethod, reflectionFocalPointRatio);
                        mc.moveTo(0, 0);
                        mc.lineTo(0, loader._height);
                        mc.lineTo(loader._width, loader._height);
                        mc.lineTo(loader._width, 0);
                        mc.lineTo(0, 0);
                        mc.endFill();
                        loader.art._alpha = reflectionAlpha;
                        loader.beginFill(reflectionBackgroundColour);
                        loader.moveTo(0, 0);
                        loader.lineTo(0, loader._height);
                        loader.lineTo(loader._width, loader._height);
                        loader.lineTo(loader._width, 0);
                        loader.lineTo(0, 0);
                        loader.endFill();
                        this["_ref"+i].draw(loader);
              }
              for (var i:Number = count=0; count<stageWidth-(centerDistance*3); count += shelveCDSpacing, i++) {
                        var cArt:MovieClip = this.createEmptyMovieClip("art"+this.getNextHighestDepth(), this.getNextHighestDepth());
                        var rArt:MovieClip = this.createEmptyMovieClip("reflection"+(this.getNextHighestDepth()-1), this.getNextHighestDepth());
                        rArt.id = cArt.id=rArt.cid=cArt.cid=Number(i)+1;
                        rArt._x = cArt._x=stageWidth;
                        cArt.DistortImage(this["_bmd"+cArt.id]);
                        controlTheObject(cArt);
                        rArt.DistortImage(this["_ref"+cArt.id]);
                        controlTheObject(rArt);
                        var tmpFilter:BlurFilter = new BlurFilter(reflectionBlurX, reflectionBlurY, reflectionQuality);
                        rArt.filterArray = cArt.filterArray=[];
                        rArt.filterArray[0] = tmpFilter;
                        rArt.filters = rArt.filterArray;
                        tmask = mask.duplicateMovieClip("_mask"+cArt.id, this.getNextHighestDepth(), {_x:mask._x, _y:mask._y});
                        rmask = mask.duplicateMovieClip("_rmask"+cArt.id, this.getNextHighestDepth(), {_x:mask._x, _y:mask._y});
                        cArt.setMask(tmask);
                        rArt.setMask(rmask);
                        rArt._visible = cArt._visible=false;
              }
              myMO.onMouseWheel = function(delta:Number):Void  {
                        if (delta>0) {
                                  next();
                        } else if (delta<=0) {
                                  previous();
                        }
              };
              myKO.onKeyDown = function():Void  {
                        if (Selection.getFocus() != "_level0.goto") {
                                  if (Key.isDown(Key.RIGHT)) {
                                            next();
                                  } else if (Key.isDown(Key.LEFT)) {
                                            previous();
                                  }
                        }
              };
              scrollBar.scroller.onPress = function():Void  {
                        dist = this._parent._xmouse-this._x;
                        this.onMouseMove = function():Void  {
                                  tmp = 1+Math.ceil(((this._parent._xmouse-dist)-scrollBarStart)/(scrollBar._width-scrollBarStop)*(infostruc.length-1));
                                  if (tmp>infostruc.length) {
                                            tmp = infostruc.length;
                                  }
                                  if (tmp<1) {
                                            tmp = 1;
                                  }
                                  current = tmp;
                                  updateInfo();
                        };
              };
              scrollBar.scroller.onRelease = scrollBar.scroller.onReleaseOutside=function ():Void {
                        stopDrag();
                        delete this.onMouseMove;
              };
              scrollBar.left.onPress = function():Void  {
                        previous();
                        shifter = setInterval(previous, scrollerDelay);
              };
              scrollBar.right.onPress = function():Void  {
                        next();
                        shifter = setInterval(next, scrollerDelay);
              };
              scrollBar.onMouseUp = function():Void  {
                        clearInterval(shifter);
              };
              scrollBar.onMouseDown = function():Void  {
                        if (this.hitTest(_xmouse, _ymouse, true) && !this.left.hitTest(_xmouse, _ymouse, true) && !this.right.hitTest(_xmouse, _ymouse, true)) {
                                  if (this._xmouse<this.scroller._x) {
                                            previous();
                                            shifter = setInterval(previous, clickDelay);
                                  }
                                  if (this._xmouse>this.scroller._x+this.scroller._width) {
                                            next();
                                            shifter = setInterval(next, clickDelay);
                                  }
                        }
              };
              goto.restrict = "0-9";
              goto.onKillFocus = function():Void  {
                        if (!isNaN(Number(this.text)+1)) {
                                  if (this.text>infostruc.length) {
                                            this.text = infostruc.length;
                                  }
                                  if (this.text<1) {
                                            this.text = 1;
                                  }
                                  current = Number(this.text);
                        } else {
                                  this.text = current;
                        }
                        updateInfo();
              };
              fscreen.onPress = function():Void  {
                        fscommand("fullscreen", !(this._currentframe-1));
                        this.gotoAndStop(!(this._currentframe-1)+1);
              };
              slideShow.onPress = function():Void  {
                        if (this._currentframe == 1) {
                                  sliderShow = setInterval(function ():Void {
                                            if (current<infostruc.length) {
                                                      next();
                                            } else if (slideshowLooping) {
                                                      current = 0;
                                                      next();
                                            }
                                  }, slideshowSpeed);
                        } else {
                                  clearInterval(sliderShow);
                        }
                        this.gotoAndStop(!(this._currentframe-1)+1);
              };
              distance = Number(i);
              mask.removeMovieClip();
              fscreen.swapDepths(1102);
              slideShow.swapDepths(1103);
              scrollBar.swapDepths(1101);
              i2.swapDepths(1105);
              i1.swapDepths(1106);
              loader.removeMovieClip();
              loadNext();
              updateInfo();
    }
    function concat(m1, m2):Object {
              var mat:Object = {};
              mat.a = m1.c*m2.b;
              mat.b = m1.d*m2.b;
              mat.c = m1.a*m2.c;
              mat.d = m1.b*m2.c;
              mat.tx = m1.a*m2.tx+m1.c*m2.ty+m1.tx;
              mat.ty = m1.b*m2.tx+m1.d*m2.ty+m1.ty;
              return mat;
    }
    function updateInfo():Void {
              goto.text = current;
              info = infostruc[current-1].info;
              author = infostruc[current-1].auth;
              album = infostruc[current-1].album;
              displayAlternArt(root["_bmd"+(current-1)], artDisplay._width, artDisplay._height);
              scrollBar.scroller._x = scrollBarStart+((current-1)/(infostruc.length-1)*(scrollBar._width-scrollBarStop));
    }
    function brightness(_prop:String, _old:Number, _new:Number, target:MovieClip):Void {
              var brightness_array:Array = [1, 0, 0, 0, _new, 0, 1, 0, 0, _new, 0, 0, 1, 0, _new, 0, 0, 0, 1, 0];
              target.filterArray[1] = new ColorMatrixFilter(brightness_array);
              target.filters = target.filterArray;
    }
    function controlTheObject(mc):Void {
              if (mc._name.indexOf("reflection") == -1) {
                        mc.onPress = function():Void  {
                                  if ((getTimer()-this.pressTime<=doubleClickRegister && this.pressTime) || !doubleClickURL) {
                                            if (infostruc[this.cid].urlToGet) {
                                                      getURL(infostruc[this.cid].urlToGet, "_"+infostruc[this.cid].urlAction);
                                            }
                                  }
                                  this.pressTime = getTimer();
                                  current = this.cid+1;
                                  updateInfo();
                        };
              }
              mc.watch("_brightness", brightness, mc);
              mc.onEnterFrame = function():Void  {
                        this._visible = true;
                        if (infostruc[this.cid].loaded && !this.loadedImage) {
                                  this.allowUpdate = true;
                                  this.DistortImage(this._name.indexOf("reflection")>-1 ? this._parent["_ref"+this.cid] : this._parent["_bmd"+this.cid]);
                                  this.setTransform(this.px1, this.py1, this.px2, this.py2, this.px3, this.py3, this.px4, this.py4);
                                  this.loadedImage = true;
                        }
                        if (Math.round(Math.abs(this._x-this.x))>=1 || this.allowUpdate) {
                                  if (this._name.indexOf("reflection") == -1) {
                                            this._y = centerY+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2));
                                            if (this._x>=centerX+centerDistance) {
                                                      this.swapDepths(-this._x);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, this._parent["_shelveCDHeight"+this.cid]/2, -(this._parent["_shelveCDWidth"+this.cid]/2), (this._parent["_shelveCDHeight"+this.cid]/2)-((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                            } else if (this._x<=centerX-centerDistance) {
                                                      this.swapDepths(this._x);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2)+(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), this._parent["_shelveCDWidth"+this.cid]/2, (this._parent["_shelveCDHeight"+this.cid]/2)-(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), -(this._parent["_shelveCDWidth"+this.cid]/2), this._parent["_shelveCDHeight"+this.cid]/2);
                                            } else if (this.cid == current-1 || this.cid == current || this.cid == current-2) {
                                                      if (this._x>centerX-centerDistance && Math.floor(this._x)<centerX && angle-((this._x-(centerX-centerDistance))/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1002);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this.setSides(-(sum/2), -(sum3/2), sum/2, -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, (sum3/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(sum/2), sum3/2);
                                                      } else if (this._x<centerX+centerDistance && Math.ceil(this._x)>centerX && angle-(((centerX+centerDistance)-this._x)/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1003);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this.setSides(-(sum/2), -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, -(sum3/2), sum/2, sum3/2, -(sum/2), (sum3/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                                      } else {
                                                                this.swapDepths(1004);
                                                                this.setSides(-(this._parent["_frontCDWidth"+this.cid]/2), -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, this._parent["_frontCDHeight"+this.cid]/2, -(this._parent["_frontCDWidth"+this.cid]/2), this._parent["_frontCDHeight"+this.cid]/2);
                                                      }
                                            } else {
                                                      if (this._x>centerX-centerDistance && Math.floor(this._x)<centerX && angle-((this._x-(centerX-centerDistance))/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1002);
                                                                var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
                                                                this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), this._parent["_shelveCDWidth"+this.cid]/2, (this._parent["_shelveCDHeight"+this.cid]/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(this._parent["_shelveCDWidth"+this.cid]/2), this._parent["_shelveCDHeight"+this.cid]/2);
                                                      } else if (this._x<centerX+centerDistance && Math.ceil(this._x)>centerX && angle-(((centerX+centerDistance)-this._x)/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1003);
                                                                var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
                                                                this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, this._parent["_shelveCDHeight"+this.cid]/2, -(this._parent["_shelveCDWidth"+this.cid]/2), (this._parent["_shelveCDHeight"+this.cid]/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                                      }
                                            }
                                  } else {
                                            this._yscale = -100;
                                            this._y = centerY+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+this._parent["_shelveCDHeight"+this.cid]+reflectionSpace;
                                            if (this._x>=centerX+centerDistance) {
                                                      this.swapDepths(-this._x-333);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2)+(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], -(this._parent["_shelveCDHeight"+this.cid]/2), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], this._parent["_shelveCDHeight"+this.cid]/2, -(this._parent["_shelveCDWidth"+this.cid]/2), (this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                            } else if (this._x<=centerX-centerDistance) {
                                                      this.swapDepths(this._x-333);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], (this._parent["_shelveCDHeight"+this.cid]/2)+(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), -(this._parent["_shelveCDWidth"+this.cid]/2), this._parent["_shelveCDHeight"+this.cid]/2);
                                            } else if (this.cid == current-1 || this.cid == current || this.cid == current-2) {
                                                      if (this._x>centerX-centerDistance && this._x<centerX && !validateOk(this)) {
                                                                this.swapDepths(999);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this._y = centerY+sum3+reflectionSpace;
                                                                this.setSides(-(sum/2), -(sum3/2), sum/2, -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, (sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(sum/2), sum3/2);
                                                      } else if (this._x<centerX+centerDistance && this._x>centerX && !validateOk(this)) {
                                                                this.swapDepths(998);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this.setSides(-(sum/2), -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, -(sum3/2), sum/2, sum3/2, -(sum/2), (sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                                                this._y = centerY+sum3+reflectionSpace;
                                                      } else if (!validateOk(this)) {
                                                                this.swapDepths(995);
                                                                this._y = centerY+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+this._parent["_frontCDHeight"+this.cid]+reflectionSpace;
                                                                this.setSides(-(this._parent["_frontCDWidth"+this.cid]/2), -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, this._parent["_frontCDHeight"+this.cid]/2, -(this._parent["_frontCDWidth"+this.cid]/2), this._parent["_frontCDHeight"+this.cid]/2);
                                                      }
                                            }
                                  }
                                  this.allowUpdate = false;
                                  this._x -= Math.min(Math.max((this._x-this.x)/albumEase, -maxSlide), maxSlide);
                                  this.setTransform(this.px1, this.py1, this.px2, this.py2, this.px3, this.py3, this.px4, this.py4);
                                  if (this._x<deleteMinDistance && this._parent["_ref"+(this.cid+distance)]) {
                                            this.cid += distance;
                                            this._x = deleteMaxDistance;
                                            controlTheObject(this);
                                            this._visible = false;
                                            this.loadedImage = infostruc[this.cid].loaded;
                                            this.DistortImage(this._name.indexOf("reflection")>-1 ? this._parent["_ref"+this.cid] : this._parent["_bmd"+this.cid]);
                                  }
                                  if (this._x>deleteMaxDistance && this._parent["_ref"+(this.cid-distance)]) {
                                            this.cid -= distance;
                                            this._x = deleteMinDistance;
                                            controlTheObject(this);
                                            this._visible = false;
                                            this.loadedImage = infostruc[this.cid].loaded;
                                            this.DistortImage(this._name.indexOf("reflection")>-1 ? this._parent["_ref"+this.cid] : this._parent["_bmd"+this.cid]);
                                  }
                        } else if (Math.ceil(Math.abs(this._x-this.x)) == 0) {
                                  this._x = this.x;
                        }
                        if (this.cid+1>current) {
                                  this.x = (centerX+((this.cid+1-current)*shelveCDSpacing))+centerDistance;
                        } else if (this.cid+1<current) {
                                  this.x = (centerX+((this.cid+1-current)*shelveCDSpacing))-centerDistance;
                        } else {
                                  this.x = centerX+((this.cid+1-current)*shelveCDSpacing);
                        }
                        if (fadeType == "brightness") {
                                  if (this._x<fadePointMin+fadeDist) {
                                            this._brightness = -(250-((this._x-fadePointMin)/fadeDist*250));
                                  } else if (this._x>fadePointMax-fadeDist) {
                                            this._brightness = -(250-((fadePointMax-this._x)/fadeDist*250));
                                  } else {
                                            this._brightness = 0;
                                  }
                        } else if (fadeType == "alpha") {
                                  if (this._x<fadePointMin+fadeDist) {
                                            this._alpha = ((this._x-fadePointMin)/fadeDist*100);
                                  } else if (this._x>fadePointMax-fadeDist) {
                                            this._alpha = ((fadePointMax-this._x)/fadeDist*100);
                                  } else {
                                            this._alpha = 100;
                                  }
                        }
              };
    }
    function next():Void {
              if (current<infostruc.length) {
                        current += 1;
              }
              updateInfo();
    }
    function previous():Void {
              if (current>1) {
                        current -= 1;
              }
              updateInfo();
    }
    function displayAlternArt(art, width:Number, height:Number):Void {
              artDisplay.attachBitmap(art, 1);
              artDisplay._width = width;
              artDisplay._height = height;
    }
    function loadNext():Void {
              if (!loadedAll) {
                        var num:Number = current-1;
                        if (infostruc[current-1].loaded) {
                                  var num:Number = current-Math.floor(distance/2)-1>=0 ? current-Math.floor(distance/2)-1 : 0;
                                  while (infostruc[num].loaded && num<infostruc.length) {
                                            num++;
                                  }
                                  if (num>=infostruc.length) {
                                            var num:Number = current-1;
                                            while (infostruc[num].loaded && num>0) {
                                                      num--;
                                            }
                                            if (num<=0) {
                                                      loadedAll = true;
                                            }
                                  }
                        }
                        var newLoad:MovieClip = this.createEmptyMovieClip("artLoad"+num, this.getNextHighestDepth());
                        newLoad.createEmptyMovieClip("art", newLoad.getNextHighestDepth());
                        newLoad._alpha = 0;
                        var mc:Object = {};
                        mc.number = num;
                        var artLoader:MovieClipLoader = new MovieClipLoader();
                        artLoader.addListener(mc);
                        artLoader.loadClip(infostruc[num].httpType+infostruc[num].art, newLoad.art);
                        mc.onLoadError = function() {
                                  infostruc[this.number].loaded = true;
                                  loadNext();
                        };
                        mc.onLoadInit = function(target:MovieClip) {
                                  tw = target._width;
                                  ty = target._height;
                                  if (_CDProportions == "auto") {
                                            if (target._width>target._height) {
                                                      target._width = Math.min(frontCDWidth, target._width);
                                                      target._yscale = target._xscale;
                                            } else {
                                                      target._height = Math.min(frontCDHeight, target._height);
                                                      target._xscale = target._yscale;
                                            }
                                  }
                                  root["_frontCDWidth"+this.number] = Math.min(frontCDWidth, target._width);
                                  root["_frontCDHeight"+this.number] = Math.min(frontCDHeight, target._height);
                                  target._width = tw;
                                  target._height = ty;
                                  root["_bmd"+this.number] = new BitmapData(target._width, target._height);
                                  root["_ref"+this.number] = new BitmapData(target._width, target._height);
                                  root["_bmd"+this.number].draw(target);
                                  var mc:MovieClip = target._parent.createEmptyMovieClip("gradient_mc", target._parent.getNextHighestDepth());
                                  matrix = new Matrix();
                                  matrix.createGradientBox(target._width, target._height, reflectionRotation/180*Math.PI, 0, 0);
                                  mc.beginGradientFill(reflectionFillType, reflectionColors, reflectionAlphas, reflectionRatios, matrix, reflectionSpreadMethod, reflectionInterpolationMethod, reflectionFocalPointRatio);
                                  mc.moveTo(0, 0);
                                  mc.lineTo(0, target._height);
                                  mc.lineTo(target._width, target._height);
                                  mc.lineTo(target._width, 0);
                                  mc.lineTo(0, 0);
                                  mc.endFill();
                                  target._parent.beginFill(reflectionBackgroundColour);
                                  target._parent.moveTo(0, 0);
                                  target._parent.lineTo(0, target._height);
                                  target._parent.lineTo(target._width, target._height);
                                  target._parent.lineTo(target._width, 0);
                                  target._parent.lineTo(0, 0);
                                  target._parent.endFill();
                                  target._alpha = reflectionAlpha;
                                  root["_ref"+this.number].draw(target._parent);
                                  infostruc[this.number].loaded = true;
                                  if (_CDProportions == "auto") {
                                            if (target._width>target._height) {
                                                      target._width = Math.min(shelveCDWidth, target._width);
                                                      target._yscale = target._xscale;
                                            } else {
                                                      target._height = Math.min(shelveCDHeight, target._height);
                                                      target._xscale = target._yscale;
                                            }
                                  }
                                  root["_shelveCDWidth"+this.number] = Math.min(shelveCDWidth, target._width);
                                  root["_shelveCDHeight"+this.number] = Math.min(shelveCDHeight, target._height);
                                  target._parent.removeMovieClip();
                                  updateInfo();
                                  loadNext();
                        };
              }
    }
    xmlData.onLoad = function(success:Boolean):Void  {
              if (success) {
                        for (var i:Number = -1; this.childNodes[0].childNodes[++i]; ) {
                                  var cNode:XMLNode = this.childNodes[0].childNodes[i].childNodes;
                                  var val1:String = cNode[1].childNodes[0].nodeValue ? unescape(cNode[1].childNodes[0].nodeValue) : unknownSong;
                                  var val2:String = cNode[2].childNodes[0].nodeValue ? unescape(cNode[2].childNodes[0].nodeValue) : unknownArtist;
                                  var val3:String = cNode[3].childNodes[0].nodeValue ? unescape(cNode[3].childNodes[0].nodeValue) : unknownAlbum;
                                  var val4:String = cNode[4].childNodes[0].nodeValue ? unescape(cNode[4].childNodes[0].nodeValue) : "./";
                                  var val5:String = cNode[5].childNodes[0].nodeValue ? unescape(cNode[5].childNodes[0].nodeValue) : undefined;
                                  var val6:String = cNode[6].childNodes[0].nodeValue ? unescape(cNode[6].childNodes[0].nodeValue) : undefined;
                                  infostruc.push({art:cNode[0].childNodes[0].nodeValue, info:val1, auth:val2, album:val3, httpType:val4, urlToGet:val5, urlAction:val6, loaded:false});
                                  root["_frontCDWidth"+i] = frontCDWidth;
                                  root["_frontCDHeight"+i] = frontCDHeight;
                                  root["_shelveCDWidth"+i] = shelveCDWidth;
                                  root["_shelveCDHeight"+i] = shelveCDHeight;
                        }
                        init();
                        loadStat = "";
              } else {
                        loadStat = "There was an error loading that data, sorry.";
              }
    };
    
    
    xmlData.ignoreWhite = true;
    loadPlayList("./albuminfo9.xml");
    loader._visible = false;
    mask._alpha = 0;
    scrollBar.scroller._y = 0;
    
    

    It will not work on most of the servers:"./albuminfo9.xml". It should be "../albuminfo9.xml". That may or may not solve the problem. Be sure that all of your files and folders are in the same relative location on the server as they are on your computer. Also be sure that the case for each referenced item is correct. Upper and lower case are sometimes more important on a server than they are on your computer. JPG is not the same as jpg. Be sure that your files are uploading correctly.

  • Interpolation of the icon, you are more to its normal state

    I have this code snippet that I've been running successfully on my image buttons grouped in a MC.

    It applies the changes to the buttons on that I'm not rolling, that is, if I had to roll over a button the rest of the buttons in the Group would be dim and blur and etc, but not the button I am more.

    Everything worked fine until I decided to group buttons once more.

    With my limited knowledge of AS3, I was able to put all the actions of the buttons except the button, I stay as it is.

    I think the problem is in the line:

    target = interpolation of the icon, you are more to its normal state

    TweenMax.to (e.target,.5, {alpha: 1, blurFilter: {blurX:0}, blurY:0 colorMatrixFilter: {colorize: 0x000000, amount: 0, brightness: 1.25, saturation: 1}, ease:Sine.easeOut});})

    }

    particularly by properly specifying e.target

    I tried a few variations, but nothing seemed to work.

    What would be a good code to go two levels deep in a MC?

    Here's my complete code:

    IMGS_COLLAGE.buttonMode = true;

    IMGS_COLLAGE.useHandCursor = true;

    IMGS_COLLAGE.imgORIGINAL_collage.addEventListener (MouseEvent.MOUSE_OVER, navOver);

    IMGS_COLLAGE.imgORIGINAL_collage.addEventListener (MouseEvent.MOUSE_OUT, navOut);

    ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////

    function navOver(e:MouseEvent):void

    {

    to loop through all the icons

    for (var i in IMGS_COLLAGE.imgORIGINAL_collage)

    {

    Tween on all icons

    TweenMax.to (IMGS_COLLAGE.imgORIGINAL_collage [i],.2, {alpha: 85., blurFilter: {blurX:11}, blurY:11 colorMatrixFilter: {colorize: 0x000000, amount: 0.25, brightness: 0.65, saturation: 0.7}, ease:Sine.easeOut});})

    }

    target = interpolation of the icon, you are more to its normal state

    TweenMax.to (e.target,.5, {alpha: 1, blurFilter: {blurX:0}, blurY:0 colorMatrixFilter: {colorize: 0x000000, amount: 0, brightness: 1.25, saturation: 1}, ease:Sine.easeOut});})

    }

    function navOut(e:MouseEvent):void

    {

    for (var i in IMGS_COLLAGE.imgORIGINAL_collage)

    {

    Tween on all the icons to a normal state

    TweenMax.to (IMGS_COLLAGE.imgORIGINAL_collage [i],.5, {alpha: 1, blurFilter: {blurX:0}, blurY:0 colorMatrixFilter: {colorize: 0x000000, amount: 0, brightness: 1, saturation: 1}, ease:Sine.easeOut});})

    }

    }

    If the mc is the objects you want to blur in and out, use:

    function navOver(e:MouseEvent):void

    {

    to loop through all the icons

    for (var i in IMGS_COLLAGE.imgORIGINAL_collage)

    {

    {if (IMGS_COLLAGE.imgORIGINAL_collage [i] .hitTestPoint (MouseX, MouseY))}

    TweenMax.to (IMGS_COLLAGE.imgORIGINAL_collage [i],.2, {alpha:. 1, blurFilter: {blurX:0}, blurY:0 colorMatrixFilter: {colorize: 0x000000, amount: 0, brightness: 1.25, saturation: 1}, ease:Sine.easeOut});})

    } else {}

    TweenMax.to (IMGS_COLLAGE.imgORIGINAL_collage [i],.2, {alpha: 85., blurFilter: {blurX:11}, blurY:11 colorMatrixFilter: {colorize: 0x000000, amount: 0.25, brightness: 0.65, saturation: 0.7}, ease:Sine.easeOut});})

    }

    }

    }

  • ActionScript 3.0 error messages

    Hello people, I am currently creating an application that allows the user to load a jpeg file, manipulate it presets using different button, then press save to JPEG, and I'm getting these error messages!

    1061: call to a possibly undefined method save through a reference with static type flash .net: FileReference-> This is the error I get to try to get the record button to work

    1013: attribute private may be used only on the property of the class definitions.-> This is the error message to try to get the load image button to work

    I am using flash CS3, FP9

    This is the code I have...

    import flash.display.BitmapData;

    Import 12345678910111213import;

    import flash.display.Sprite;

    import flash.filters.DropShadowFilter;

    Import fl.motion.Color;

    import flash.events.Event;

    import com.adobe.images.JPGEncoder;

    var filterArray = new Array();

    btnSave.addEventListener (MouseEvent.MOUSE_DOWN, saveJPGimage);

    function saveJPGimage(Event:MouseEvent):void {}

    var imageCapture:BitmapData = new BitmapData (295, 225);

    imageCapture.draw (sp, null, null, 'normal', new Rectangle (10, 10, 295, 225), true);

    var jpgEncoder:JPGEncoder = new JPGEncoder (80);

    var jpgBytes:ByteArray = jpgEncoder.encode (imageCapture);

    var fileRef:FileReference = new FileReference();

    fileRef.save (jpgBytes, "" output. "") JPG');

    }

    btnBlur.addEventListener (MouseEvent.MOUSE_DOWN, BlurImage);

    function BlurImage(evt:Event):void {}

    var myBlur:BlurFilter = new BlurFilter();

    filterArray.push (myBlur);

    trace (filterArray);

    SP.filters = filterArray;

    }

    btnGlow.addEventListener (MouseEvent.MOUSE_DOWN, GlowImage);

    function GlowImage(evt:Event):void {}

    var myGlow:GlowFilter = new GlowFilter();

    filterArray.push (myGlow);

    trace (filterArray);

    SP.filters = filterArray;

    }

    btnReset.addEventListener (MouseEvent.MOUSE_DOWN, resetImage);

    function resetImage(evt:Event):void {}

    filterArray = [];

    sp.blendMode = BlendMode.NORMAL;

    SP.filters = filterArray;

    }

    btnSharpen.addEventListener (MouseEvent.MOUSE_DOWN, sharpenImage);

    function sharpenImage(evt:Event):void {}

    sharpen var: Array = [0, - 1, 0,-1, 5 - 1, 0,-1, 0];

    var conv2:ConvolutionFilter = new ConvolutionFilter (3, 3, sharpen, 1);

    filterArray.push (conv2);

    SP.filters = filterArray;

    }

    btnBrightness.addEventListener (MouseEvent.MOUSE_DOWN, brightnessImage);

    function brightnessImage(evt:Event):void {}

    var light: Array = [0, 0, 0, 0, 1,1, 0, 0, 0, 0];

    var conv2:ConvolutionFilter = new ConvolutionFilter (3, 3, brightness, 1);

    filterArray.push (conv2);

    SP.filters = filterArray;

    }

    btnDarkness.addEventListener (MouseEvent.MOUSE_DOWN, brightDown);

    function brightDown(evt:Event):void {}

    var light: Array = [0, 0, 0, 0, 0.9, 0, 0, 0, 0];

    var conv2:ConvolutionFilter = new ConvolutionFilter (3, 3, brightness, 1);

    filterArray.push (conv2);

    SP.filters = filterArray;

    }

    btnLoad1.addEventListener (MouseEvent.MOUSE_DOWN, loadFile);

    var _loadFile:FileReference;

    function startLoadingFile (): void {}

    _loadFile = new FileReference();

    _loadFile.addEventListener (Event.SELECT, selectHandler);

    var fileFilter:FileFilter = new FileFilter ("Images: (*.jpeg, *.jpg, *.gif, *.png)", "*.jpeg;) *.jpg; *.gif; *.png");

    _loadFile.browse ([fileFilter]);

    }

    private void selectHandler(event:Event):void {}

    _loadFile.removeEventListener (Event.SELECT, selectHandler);

    _loadFile.addEventListener (Event.COMPLETE, loadCompleteHandler);

    _loadFile.load ();

    }

    If you use CS3, his version of AS3 does not at all support the FileReference.Save () method.  You will need to find another way of saving a file (PHP script on the server side).

  • problem with an interpolation of text

    I have a page that I develop which has a field of greensock split text I use to animate text. http://jimslounge.com/Segovia/

    I use a timer to help control the interpolation it does not real smooth.

    import com.greensock;

    com.greensock.easing import. *;

    com.greensock.text import. *;

    import com.greensock.text.SplitTextField;

    var segovia_stf:SplitTextField;

    var myTextLoader:URLLoader = new URLLoader();

    myTextLoader.addEventListener (Event.COMPLETE, onLoaded);

    var myTimer:Timer = new Timer (9000);

    myTimer.addEventListener (TimerEvent.TIMER, timerListener);

    function timerListener (e:TimerEvent): void {}

    runText();

    }

    myTimer.start ();

    function onLoaded(e:Event):void {}

    segovia_mc.segovia_txt. Text = e.target.data;

    segovia_stf = new SplitTextField (segovia_mc.segovia_txt);

    }

    function runText (): void {}

    segovia_mc.y-= 110;

    If (segovia_mc.y <-330) {segovia_mc.y = 0 ;}

    for (var i: int = segovia_stf.textFields.length - 1; i > - 1; i--) {}

    TweenMax.to (segovia_stf.textFields [i], 1, {blurFilter: {blurX:10, blurY:10},})

    x: Math.Random () * 650-100, y:Math.random() * 350-100,.

    scaleX:Math.random() * 4-2, scaleY: Math.Random () * 4 - 2,.

    rotation: Math.Random () * 360-180, autoAlpha: 0,.

    ({delay: Math.Random () * 0.4, repetition: 1, ease:Quad.easeIn, repeatDelay:0.2, yoyo: true});

    }

    }

    myTextLoader.load (new URLRequest ("myText.txt"));

    There was a small problem fix carl dealing that not all of the text showed in the first race, so I added

    segovia_mc.y = 0; before you start the timer.  Now my code looks like

    import com.greensock;

    com.greensock.easing import. *;

    com.greensock.text import. *;

    import com.greensock.text.SplitTextField;

    var segovia_stf:SplitTextField;

    var myTextLoader:URLLoader = new URLLoader();

    myTextLoader.addEventListener (Event.COMPLETE, onLoaded);

    var myTimer:Timer = new Timer (11000);

    myTimer.addEventListener (TimerEvent.TIMER, timerListener);

    function timerListener (e:TimerEvent): void {}

    runText();

    }

    segovia_mc.y = 0;

    myTimer.start ();

    function onLoaded(e:Event):void {}

    segovia_mc.segovia_txt. Text = e.target.data;

    segovia_stf = new SplitTextField (segovia_mc.segovia_txt);

    }

    function runText (): void {}

    don't move the text until after the tweens have begun

    TweenLite.delayedCall (. 1, shiftText);

    for (var i: int = segovia_stf.textFields.length - 1; i > - 1; i--) {}

    remove the delay of this interpolation property

    TweenMax.to (segovia_stf.textFields [i], 1, {blurFilter: {blurX:10, blurY:10},})

    x: Math.Random () * 650-100, y:Math.random() * 350-100,.

    scaleX:Math.random() * 4-2, scaleY: Math.Random () * 4 - 2,.

    rotation: Math.Random () * 360 - 180, autoAlpha: 0, ease:Quad.easeIn, repetition: 1, yoyo: true, repeatDelay:0.2});

    }

    }

    function shiftText() {}

    segovia_mc.y = 110;

    If (segovia_mc.y< -330)="">

    segovia_mc.y = 0;

    }

    }

    myTextLoader.load (new URLRequest ("myText.txt"));

  • Error 1069 property 0 not found on flash.text.TextField and there is no default value

    So, I worked on it for a few days and what makes me crazy is this is a simple file with many simple script and I still can't seem to understand what is this error and how to fix it: property 0 not found on flash.text.TextField and there is no default

    The script below what we look at, everything is drawn with AS3, there is no object library (except for the police). I little understand what means the error, but I do not understand it or how to fix it.

    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.filters.BlurFilter;
    import flash.display.Shape;
    
    import flash.display.Sprite;
    import flash.display.Graphics;
    import flash.events.*;
    import flash.geom.*;
    import flash.events.*;
    
    var boxBg:Shape = new Shape();
        
    boxBg.graphics.lineStyle(1, 0x000000, .5, true);
    boxBg.graphics.beginFill(0xff6600);
    boxBg.graphics.drawRect(0, 0, 50, 50);
    boxBg.graphics.endFill();
    
    var box:Sprite = new Sprite();
    box.x = 335;
    box.y = 245;
    
    addChild(box);
    box.addChild(boxBg);
    
    var toggleBg:Shape = new Shape();
    var toggleBtn:Sprite = new Sprite();
        
    toggleBg.graphics.lineStyle(1, 0xefefef, .5, true);
    toggleBg.graphics.beginFill(0xffffff);
    toggleBg.graphics.drawCircle(0, 0, 25);
    toggleBg.graphics.endFill();
    toggleBtn.buttonMode = true;
    toggleBtn.mouseChildren = false;
    
    toggleBtn.x = stage.stageWidth - 75;
    toggleBtn.y = 25;
    
    addChild(toggleBtn);
    toggleBtn.addChild(toggleBg);
    
    for (var i:int = 0; i < 10; i++) {
        var btnBg:Shape = new Shape();
        
        btnBg.graphics.lineStyle(1, 0xefefef, .5, true);
        btnBg.graphics.beginFill(0xffffff);
        btnBg.graphics.moveTo(12, 0);
        btnBg.graphics.lineTo(24, 20);
        btnBg.graphics.lineTo(0, 20);
        btnBg.graphics.lineTo(12,0);
        btnBg.graphics.endFill();
        
        var btnFont = new Myriad();
        
        var btnFormat:TextFormat = new TextFormat();
        btnFormat.font = btnFont.fontName;
        btnFormat.size = 12;
        btnFormat.align = "center";
        btnFormat.color = 0xffffff;
        
        var btnTxt:TextField = new TextField();
        btnTxt.defaultTextFormat = btnFormat;
        btnTxt.width = 50;
        btnTxt.height = 20;
        btnTxt.y = 5;
        
        var myBtn:Sprite = new Sprite();
        
        myBtn.name = ("Blend " + (i + 1));
        myBtn.buttonMode = true;
        myBtn.mouseChildren = false;
        
        addChild(myBtn);
        
        myBtn.x = 10 + (i * 75);
        myBtn.y = 500;
        
        myBtn.addChild(btnBg);
        myBtn.addChild(btnTxt);
        
        btnTxt.text = myBtn.name;
        
        myBtn.addEventListener(MouseEvent.CLICK, btnHandler);
        myBtn.addEventListener(MouseEvent.ROLL_OVER, btnHandler);
        myBtn.addEventListener(MouseEvent.ROLL_OUT, btnHandler);
        toggleBtn.addEventListener(MouseEvent.MOUSE_DOWN, onToggleVisible);
    }
    
    function btnHandler(event:MouseEvent):void {
        if(event.type == MouseEvent.CLICK){
            if(event.currentTarget == btnTxt[0]){
                box.blendMode = BlendMode.NORMAL;
            }
            
            if(event.currentTarget == btnTxt[1]){
                box.blendMode = BlendMode.DARKEN;
            }
            
            if(event.currentTarget == btnTxt[2]){
                box.blendMode = BlendMode.DIFFERENCE;
            }
            if(event.currentTarget == btnTxt[3]){
                box.blendMode = BlendMode.HARDLIGHT;
            }
            
            if(event.currentTarget == btnTxt[4]){
                box.blendMode = BlendMode.INVERT;
            }
            
            if(event.currentTarget == btnTxt[5]){
                box.blendMode = BlendMode.LIGHTEN;
            }
            
            if(event.currentTarget == btnTxt[6]){
                box.blendMode = BlendMode.MULTIPLY;
            }
            
            if(event.currentTarget == btnTxt[7]){
                box.blendMode = BlendMode.OVERLAY;
            }
            
            if(event.currentTarget == btnTxt[8]){
                box.blendMode = BlendMode.SCREEN;
            }
            
            if(event.currentTarget == btnTxt[9]){
                box.blendMode = BlendMode.SUBTRACT;
            }
        }
    }
        
    function onToggleVisible(event:MouseEvent):void {
        box.visible = !box.visible;
    }
    

    I have made through problems similar, but could not find an adequate solution. If anyone can help me identify the problem and the solution, I would be extremely grateful.

    The following code makes more sense, it is more efficient (although it may be more efficient), and it is better organized:

    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.*;
    import flash.geom.*;
    import flash.events.*;
    import flash.text.*;
    
    var box:Sprite;
    var toggleBtn:Sprite;
    var btnFont:Font;
    var btnFormat:TextFormat;
    
    init();
    
    function init():void
    {
         initFormat();
         makeBox();
         makeToggleButton();
         makeButtons();
    }
    
    function initFormat():void
    {
         btnFont = new Myriad();
         btnFormat = new TextFormat();
         btnFormat.font = btnFont.fontName;
         btnFormat.size = 12;
         btnFormat.align = "center";
         btnFormat.color = 0xffffff;
    }
    
    function makeToggleButton():void
    {
         toggleBtn = new Sprite();
         toggleBtn.graphics.lineStyle(1, 0xefefef, .5, true);
         toggleBtn.graphics.beginFill(0xffffff);
         toggleBtn.graphics.drawCircle(0, 0, 25);
         toggleBtn.graphics.endFill();
         toggleBtn.buttonMode = true;
         toggleBtn.mouseChildren = false;
         toggleBtn.addEventListener(MouseEvent.MOUSE_DOWN, onToggleVisible);
         addChild(toggleBtn);
    
         toggleBtn.x = stage.stageWidth - 75;
         toggleBtn.y = 25;
    }
    
    function makeBox():void
    {
         box = new Sprite();
         box.graphics.lineStyle(1, 0x000000, .5, true);
         box.graphics.beginFill(0xff6600);
         box.graphics.drawRect(0, 0, 50, 50);
         box.graphics.endFill();
    
         addChild(box);
    
         box.x = 335;
         box.y = 245;
    }
    
    function makeButtons():void
    {
         var myBtn:Sprite;
         for (var i:int = 0; i < 10; i++)
         {
              myBtn = drawButton("Blend " + (i + 1));
              addChild(myBtn);
              myBtn.x = 10 + i * 75;
              myBtn.y = 500;
              myBtn.addEventListener(MouseEvent.CLICK, btnHandler);
              myBtn.addEventListener(MouseEvent.ROLL_OVER, btnHandler);
              myBtn.addEventListener(MouseEvent.ROLL_OUT, btnHandler);
         }
    }
    
    function btnHandler(e:MouseEvent):void
    {
         if (e.type == MouseEvent.CLICK)
         {
              switch (e.currentTarget.name)
              {
                   case "Blend 1":
                        box.blendMode = BlendMode.NORMAL;
                        break;
                   case "Blend 2":
                        box.blendMode = BlendMode.DARKEN;
                        break;
                   case "Blend 3":
                        box.blendMode = BlendMode.DIFFERENCE;
                        break;
                   case "Blend 4":
                        box.blendMode = BlendMode.HARDLIGHT;
                        break;
                   case "Blend 5":
                        box.blendMode = BlendMode.INVERT;
                        break;
                   case "Blend 6":
                        box.blendMode = BlendMode.LIGHTEN;
                        break;
                   case "Blend 7":
                        box.blendMode = BlendMode.MULTIPLY;
                        break;
                   case "Blend 8":
                        box.blendMode = BlendMode.OVERLAY;
                        break;
                   case "Blend 9":
                        box.blendMode = BlendMode.SCREEN;
                        break;
                   case "Blend 10":
                        box.blendMode = BlendMode.SUBTRACT;
                        break;
              }
         }
    }
    
    function onToggleVisible(e:MouseEvent):void
    {
         box.visible = !box.visible;
    }
    
    function drawButton(buttonName:String):Sprite
    {
         var btnTxt:TextField = new TextField();
         btnTxt.defaultTextFormat = btnFormat;
         btnTxt.width = 50;
         btnTxt.height = 20;
         btnTxt.y = 5;
         btnTxt.text = buttonName;
    
         var myBtn:Sprite = new Sprite();
         myBtn.graphics.lineStyle(1, 0xefefef, .5, true);
         myBtn.graphics.beginFill(0xffffff);
         myBtn.graphics.moveTo(12, 0);
         myBtn.graphics.lineTo(24, 20);
         myBtn.graphics.lineTo(0, 20);
         myBtn.graphics.lineTo(12, 0);
         myBtn.graphics.endFill();
    
         myBtn.name = buttonName;
         myBtn.buttonMode = true;
         myBtn.mouseChildren = false;
    
         myBtn.addChild(btnBg);
         myBtn.addChild(btnTxt);
    
         return myBtn;
    }
    

Maybe you are looking for