GlowFilter

Hello again!
I am trying to use GlowFilter as is showed on this link :
Glow
filter -- Flash CS3
I have imported flash.filters.GlowFilter, but I get the
follwoing error: The class or interface 'flash.filters.GlowFilter'
could not be loaded.
Howcome? How can I solve this?
Is there a better way to make the focus a glow filter
does?

Ah, give the Sprite a stroke.

Similar Messages

  • ScaleX,scaleY affect GlowFilter and BitmapFill strangely

    I'm using scaleX and scaleY to resize a large container full of custom renderers.  These containers have a checkerboard BitmapFill and a GlowFilter.  The bitmap fill scales horribly- it blinks between different appearances at different zoom levels.  The GlowFilter doesn't scale at all- meaning if it's 10px blur at the normal size, it will be also be a 10px blur even if the size is shrunk by 75%.
    Are scaleX and scaleY not the right values to use to resize the large container?  If not, how should I resize the container so it appears like I'm zooming in/out on it, as if on an image?
    Thanks

    Hi,
    A couple of thoughts, maybe not so useful...
    could you over-ride the scaling in the fill so that the pattern remains the same, bind the glow parameters to the scaling (create a variable that reduces by the scale factor). Also with filters not sure if postLayoutTransformOffsets would be helpful.
    Have you tried using the z-axis to create the zoom effect, not sure what you are trying to do but this might be an option...
    David.

  • Glowfilter sometimes adds a line across the middle of the bitmap

    I am using a glowfilter to draw the outline of a shape onto a bitmap.  I set both inner and knockout to true.
    Most of the time when I apply the filter, all goes well.  But sometimes, some of the shapes end up with a horizontal line across the middle.
    Does anyone have any idea what might cause this, and what workaround could be used to avoid it?

    Hey Dean Marvin,
    Thanks for the question. These two symptoms are probablyh related. To troubleshoot, let's try resetting your iPod:
    How to reset iPod
    http://support.apple.com/kb/HT1320
    Thanks,
    Matt M.

  • GlowFilter removing messing with graphics transparency

    Hi,
    My problem is I'd like to retain the transparency of a
    graphics fill on a DisplayObject after applying a filter. If I
    draw, say a rectangle, through a Sprite's Graphics and while doing
    so, specify some transparency:
    var spr:Sprite = new Sprite();
    var g:Graphics = spr.graphics as Graphics;
    g.beginFill(0x00ff00,
    0.5);
    g.drawRect(0,0,200,200);
    g.endFill();
    addChild(spr);
    Then apply a filter to the Sprite:
    spr.filters = [new GlowFilter(...params...)];
    The Sprite, spr, has the filter applied behind it such that,
    if the Sprite were opaque, the edges appear to glow. However, with
    that 0.5 alpha in the graphics, I can now see through the Sprite
    and what is immediately behind it is the Filter itself, not the
    stage. In other words, the GlowFilter is not only applied to the
    edges of the Sprite, but to the entire Sprite.
    Same is true with DropShadowFilter, I have yet to test the
    others.
    Does anyone know a purely ActionScript way to have only the
    edges be affected by the filter so I can still see through the
    Sprite? I know I could just create a image file in Photoshop with
    appropriate filters, then import to flash library, but I'd like to
    do this with just ActionScript if possible.
    Thanks in advance.

    Ah, give the Sprite a stroke.

  • [svn] 2905: Changes to allow UIComponent to take advantage of the new bindable filters (bindable wrappers around DropShadowFilter, GlowFilter, etc.

    Revision: 2905
    Author: [email protected]
    Date: 2008-08-19 13:45:59 -0700 (Tue, 19 Aug 2008)
    Log Message:
    Changes to allow UIComponent to take advantage of the new bindable filters (bindable wrappers around DropShadowFilter, GlowFilter, etc. that will force the filter stack to be re-evaluated when one or more of the filter parameters change). Checkin-tests: PASS
    Reviewer: Jason
    Bugs: SDK-16311
    QA: Yes
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-16311
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/core/Group.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/BevelFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/BlurFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/ColorMatrixFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/ConvolutionFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/DisplacementMapFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/DropShadowFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/GlowFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/GradientBevelFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/GradientFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/GradientGlowFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/BitmapGraphic.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/Parser.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/StrokedElement.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/graphicsClasses/GraphicElement .as
    flex/sdk/trunk/frameworks/projects/framework/src/FrameworkClasses.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as
    flex/sdk/trunk/tools/dependencychecker/flex/tools/dependencychecker/FrameworkSwcDependenc yRules.java
    Added Paths:
    flex/sdk/trunk/frameworks/projects/framework/src/mx/filters/
    flex/sdk/trunk/frameworks/projects/framework/src/mx/filters/BaseDimensionFilter.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/filters/BaseFilter.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/filters/IBitmapFilter.as
    Removed Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/BaseDimensionFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/BaseFilter.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/filters/IBitmapFilter.as

  • Adding listeners for instances on other frames

    I'm trying to create a very standard menu, the type where there are links on each page that links to each other. So far I've put each menu page on a separate frame (total around 35 frames), and each link as its own instance/class. Originally I planned to create an array containing all the links like this:
    var menuLinks:Array =
                                //Main menu - frame 1
                                menuRightSide.newStoryLink,
                                menuRightSide.continueStoryLink,
                                menuRightSide.selectChapterLink,
                                menuRightSide.optionsLink,
                                menuRightSide.charactersLink,
                                menuRightSide.aboutLink,
                                //chapters menu - frame 2
                                menuRightSide.chapter1,
                                menuRightSide.chapter2,
                                menuRightSide.chapter3,
                                menuRightSide.chapter4,
                                menuRightSide.chapter5,
                                //characters - frame 3
                                menuRightSide.char1,
                                menuRightSide.char2,
                                menuRightSide.char3,
                                menuRightSide.char4,
                                menuRightSide.char5,
                                menuRightSide.char6,
                                //options - frame 4
                                menuRightSide.languageLink,
                                menuRightSide.costumeLink,
                                //function links - these exist on MULTIPLE frames/pages, eg options, characters, chapters all have backToMainLink
                                menuRightSide.backToMainLink,
                                menuRightSide.backToCharLink,
                                menuRightSide.backToOptionsLink,
                                menuRightSide.backToCostumeLink,
                                ]; //create array of links for menus
                currentPage = "main_menu";
                for each (var links:MovieClip in menuLinks)
                    links.buttonMode = true; //set links to behave like button
                    links.mouseChildren = false; //mouse over does not affect this instance's children
                    links.addEventListener(MouseEvent.ROLL_OVER, onOver);
                    links.addEventListener(MouseEvent.ROLL_OUT, onOut);
                    links.addEventListener(MouseEvent.CLICK, onClick);
                function onOver(e:MouseEvent):void //apply glow to every link
                    TweenMax.to(e.target, 1, {glowFilter:{color:0xFFFFFF, alpha:1, blurX:10, blurY:10}}); //glow effect
                function onOut(e:MouseEvent):void //remove glow on link on mouse out
                    TweenMax.to(e.target, 1, {glowFilter:{color:0xFFFFFF, alpha:0, blurX:0, blurY:0, remove:true}}); //remove glow
                function onClick(e:MouseEvent):void
                    currentPage = e.target.name;
                    if (e.target.name == "newStoryLink") { //if click newStoryLink
                        delegate.beginStory();
                    } else if (e.target.name == "optionsLink") { //if click optionsLink
                        TweenLite.to(menuRightSide, 0.2, {alpha:0, onComplete:menuRightSide.gotoAndStop, onCompleteParams:[45]}); //go to frame 45, options screen
                        TweenLite.to(menuRightSide, 0.2, {alpha:1, delay:0.2});
                    } else if (e.target.name == "charactersLink") { //if click charactersLink
                        TweenLite.to(menuRightSide, 0.2, {alpha:0, onComplete:menuRightSide.gotoAndStop, onCompleteParams:[10]}); //go to frame 10, char screen
                        TweenLite.to(menuRightSide, 0.2, {alpha:1, delay:0.2});
                    } else if (e.target.name == "aboutLink") { //if click aboutLink
                        TweenLite.to(menuRightSide, 0.2, {alpha:0, onComplete:menuRightSide.gotoAndStop, onCompleteParams:[180]}); //go to frame 180, about screen
                        TweenLite.to(menuRightSide, 0.2, {alpha:1, delay:0.2});
    Basically adding listener for every link, then simply telling AS what to do when I click the link regardless of what page I'm currently on.
    However the problem is I realized listeners can't be added for links that exist on other frames other than frame 1, because they're null I think until AS flips to that frame.
    So does anyone have an idea on how I should code this? Another challenge is some links (the ones at the bottom of the array) exist on MULTIPLE frames, but perform the exact same thing regardless of which page it was clicked on.
    Thanks.

    I arranged them on separate frames because that way I know exactly what's on each page. If I simply list out all the links on one frame, then it gets extremely messy visually.
    So if I want to add listeners on other frames, how would I do that? I know the pseudo-code:
    on frame 1:
    for (each link on frame 1) {
    link.addEventListener()
    on frame 2:
    for (each link on frame 2) {
    link.addEventListener()
    ... etc
    function onClick(e:MouseEvent):void
                    currentPage = e.target.name;
                    if (e.target.name == "newStoryLink") {
                        delegate.beginStory();
                    } else if (e.target.name == "continueStoryLink") {
                        //do something else

  • How can I create a Glow without using a filter

    I am creating an application for iPhone4, and one of the problems I am having is the lack of filter support.
    I am trying to create a "stroke" around some bitmaps... an example would be a text field that is white on a bright background - I would put a black stroke around it to contract it... there are other needs as well, but this is an example.
    Before, I would just put a glow filter on the text field, tweak the settings and it looked good and did exactly what I wanted.
    But iPhone4 high resolution with gpu acceleration don't support filters - and I can't change those requirements... so any and all bitmap filters are out.
    Does anyone know of a way I can create a glow filter effect without using filters that would not be a major preformance hit for fps and memory?

    Have you tried using tweenMax and code in a glow effect.
    Something like this:
    import com.greensock.*;
    import com.greensock.plugins.*;
    TweenPlugin.activate([TintPlugin]);
    var glowEffect:TweenMax = new TweenMax(mc,0,{glowFilter:{color:0x330000,alpha:1,blurX:5,blurY:5,strength:2,quality:2,ov erwrite:5}});

  • How to use filters on ios mobile devices (iPhone/iPad) using GPU rendering (Solved)

    Many moons ago I asked a question here on the forums about how to use filters (specifically a glow filter) on a mobile devices (specifically the iPhone) when using GPU rendering and high resolution.
    At the time, there was no answer... filters were unsupported. Period.
    Well, Thanks to a buddy of mine, this problem has been solved and I can report that I have gotten a color matrix filter for desaturation AND a glow filter working on the iPhone and the iPad using GPU rendering and high resolution.
    The solution, in a nut shell is as follows:
    1: Create your display object... ie: a sprite.
    2. Apply your filter to the sprite like you normally would.
    3. Create a new bitmapdata and then draw that display object into the bitmap data.
    4. Put the new bitmapdata into a bitmap and then put it on the stage or do what you want.
    When you draw the display object into the bitmapdata, it will draw it WITH THE FILTER!
    So even if you put your display object onto the stage, the filter will not be visible, but the new bitmapdata will!
    Here is a sample app I created and tested on the iphone and ipad
    var bm:Bitmap;
    // temp bitmap object
    var bmData:BitmapData;
    // temp bitmapData object
    var m:Matrix;
    // temp matrix object
    var gl:GlowFilter;
    // the glow filter we are going to use
    var sprGL:Sprite;
    // the source sprite we are going to apply the filter too
    var sprGL2:Sprite;
    // the sprite that will hold our final bitmapdata containing the original sprite with a filter.
    // create the filters we are going to use.
    gl = new GlowFilter(0xFF0000, 0.9, 10, 10, 5, 2, false, false);
    // create the source sprite that will use our glow filter.
    sprGL = new Sprite();
    // create a bitmap with any image from our library to place into our source sprite.
    bm = new Bitmap(new Msgbox_Background(), "auto", true);
    // add the bitmap to our source sprite.
    sprGL.addChild(bm);
    // add the glow filter to the source sprite.
    sprGL.filters = [gl];
    // create the bitmapdata that will draw our glowing sprite.
    sprGL2 = new Sprite();
    // create the bitmap data to hold our new image... remember, with glow filters, you need to add the padding for the flow manually. Should be double the blur size
    bmData = new BitmapData(sprGL.width+20, sprGL.height+20, true, 0);
    // create a matrix to translate our source image when we draw it. Should be the same as our filter blur size.
    m = new Matrix(1,0,0,1, 10, 10);
    // draw the source sprite containing the filter into our bitmap data
    bmData.draw(sprGL, m);
    // put the new bitmap data into a bitmap so we can see it on screen.
    bm = new Bitmap(bmData, "auto", true);
    // put the new bitmap into a sprite - this is just because the rest of my test app needed it, you can probably just put the bitmap right on the screen directly.
    sprGL2.addChild(bm);
    // put the source sprite with the filter on the stage. It should draw, but you will not see the filter.
    sprGL.x = 100;
    sprGL.y = 50;
    this.addChild(sprGL);
    // put the filtered sprite on the stage. it shoudl appear like the source sprite, but a little bigger (because of the glow padding)
    // and unlike the source sprite, the flow filter should acutally be visible now!
    sprGL2.x = 300;
    sprGL2.y = 50;
    this.addChild(sprGL2);

    Great stuff dave
    I currently have a slider which changes the hue of an image in a movieclip, I need it to move through he full range -180 to 180.
    I desperately need to get this working on a tablet but cant get the filters to work in GPU mode. My application works too slow in cpu mode.
    var Mcolor:AdjustColor = new AdjustColor();   //This object will hold the color properties
    var Mfilter:ColorMatrixFilter;                           //Will store the modified color filter to change the image
    var markerSli:SliderUI = new SliderUI(stage, "x", markerSli.track_mc, markerSli.slider_mc, -180, 180, 0, 1);   //using slider from http://evolve.reintroducing.com
    Mcolor.brightness = 0;  Mcolor.contrast = 0; Mcolor.hue = 0; Mcolor.saturation = 0;            // Set initial value for filter
    markerSli.addEventListener(SliderUIEvent.ON_UPDATE, markerSlider);                          // listen for slider changes
    function markerSlider($evt:SliderUIEvent):void {
        Mcolor.hue = $evt.currentValue;                        
        updateM();
    function updateM():void{
        Mfilter = new ColorMatrixFilter(Mcolor.CalculateFinalFlatArray());
        all.marker.filters = [Mfilter];
    how would I use your solution in my case
    many thanks.

  • Need help with finding picture size

    ok here is  my problem i have this sphere and it works great except when you click the thumbnails to display the picture, depending on the size of the picture, the pictures can get pushed to far over, and i understand why. the x and y coord never change. now my idea is to get the size of picture and use that to adjust the x-coord accordingly. my question is. how do i get the picture size? if i can. do the pictures have to be in the fla?
    heres code:
    The radius of the sphere, 'rad'. You can change it if you wish
    especially if you use thumbnails of a different size than our thumbnails.
    var rad:Number=380;
    The position of 'board' that will be defined later. 'board' is the main
    container containing the sphere and the black background
    that reponds to mouse actions.
    var posX:Number=stage.stageWidth/2;
    var posY:Number=stage.stageHeight/2;
    The size of thumbnails. Change the values to reflect the size of your
    images.
    var thumbWidth:Number=70;
    var thumbHeight:Number=53;
    The thumbnail images have been imported to the Library and linked to AS3
    under the names 'Small1', 'Small2',....,'Small46'. The corresponding
    Bitmap objects will be stored in the array 'thumbsArray'.
    var thumbsArray:Array=[];
    The addresses of the images corresponding to the thumbnails are stored
    in 'picsArray'. The images will be loaded at runtime when the user
    clicks on each thumbnail.
    var picsArray:Array=[];
    The Bitmap object corresponding to each thumbnail will be placed
    in a Sprite, holdersArray[i][j], as its child. We have to do this
    to make thumbnails responsive to mouse clicks.
    var holdersArray:Array=[];
    In order to depth-sort images on the sphere, we will need to keep
    track of their midpoints and the position of each midpoint in 3D.
    The midpoints will be stored in 'midsArray'.
    var midsArray:Array=[];
    The only part of our spherical menu that is hard-wired (and a bit harder
    to customize) is the number of thumbnails and their placement on the sphere.
    We have 46 thumbnails placed along 7 horizontal 'circles' on the sphere.
    The 'jLen' vector describes the number of thumbnails on each circle.
    The first 'circle' is the north pole and contains 1 image; the second
    is the circle corresponding to the vertical angle of 30 degrees
    from the negative y axis. That circle contains 6 images. The next one,
    at 60 degree of vertical displacement contains 10 images;
    the one after that, at 90 degrees from the negative y axis, is the equador
    of the sphere and contains 12 images. Past that, we go symmetrically:
    10, 6, and 1 image at the south pole.
    All our arrays are organized to reflect that placement of thumbnails.
    For example, thumbsArray is an array of arrays, thumbsArray[i], where
    i corresponds to the number of each circle. thumbsArray[i][j] is the
    j-th image on the i-th of the seven circles.
    var jLen:Vector.<Number>=new Vector.<Number>();
    jLen=Vector.<Number>([1,6,10,12,10,6,1]);
    We use the almost standard parametrization of a sphere:
    phi is the vertical angle measured from the vertical axis
    pointing upwards (in Flash's coordinate system this is the negative
    y-axis), theta is the horizontal angle measured from the
    horizontal axis pointing away from the screen; that is,
    the negative z-axis. phi changes from 0 to 90 degrees,
    theta from 0 to 360 degrees. For each circle, phi is constant:
    0, 30, 60, 90, 120, 150, 180. 'thetaStep' contains the angular
    distances between thumbnails on each circle. Except
    for the north and the south pole, for each circle
    the angular distance between thumbnails equals to 360 divided
    by the number of thumbnails on the circle.
    var thetaStep:Vector.<Number>=new Vector.<Number>();
    thetaStep=Vector.<Number>([0,60,36,30,36,60,0]);
    //The vertical angle between circles.
    var phiStep:Number=30;
    To make images tangent to the sphere, we need to tilt them
    vertically and horizontally. Horizontal tilt is always
    equal to the theta angle of the midpoint
    of the image and changes along each circle;
    the vertical tilt is based on the values
    of phi and is constant for each circle of thumbnails.
    var phiTilt:Vector.<Number>=new Vector.<Number>();
    phiTilt=Vector.<Number>([-90,-60,-30,0,30,60,90]);
    //The next four variables are related to auto-rotation
    //and rotation by the user.
    var autoOn:Boolean=true;
    var manualOn:Boolean=false;
    var prevX:Number;
    var prevY:Number;
    //The amount of perpective distortion. Higher values give more distortion.
    //Values have to be between 0 and 180 as they correspond to the view angle.
    this.transform.perspectiveProjection.fieldOfView=70;
    //We define and position the container 'board'.
    var board:Sprite=new Sprite();
    this.addChild(board);
    board.x=posX;
    board.y=posY;
    //We call the function that draws the border and the background
    //of 'board'.
    drawBoard();
    //Settings for our dynamic text boxes present on the Stage.
    infoBox.mouseEnabled=false;
    infoBox.wordWrap=true;
    infoBox.text="";
    loadBox.mouseEnabled=false;
    loadBox.wordWrap=true;
    loadBox.text="";
    loadBox.visible=false;
    When the user double-clicks on a thumbnail, the corresponding image
    will be loaded into 'loader' - an instance of the Loader class.
    'loader' is a child of the Sprite, 'photoHolder', which is a child
    of the MainTimeline.
    var photoHolder:Sprite=new Sprite();
    this.addChild(photoHolder);
    photoHolder.x=200;
    photoHolder.y=100;
    var loader:Loader=new Loader();
    photoHolder.addChild(loader);
    photoHolder.visible=false;
    We will literally 'build' a shere of thumbnails by positioning
    them in a Sprite called 'spSphere'. The moment we assign
    any of the 3D properties to 'spSphere', for example a value for the z coordinate,
    spSphere becomes a 3D container. That means we can place elements in it
    in 3D. We will also be able to apply 3D methods to 'spSphere', e.g. rotations.
    When 'spSphere' becomes a 3D display object, it has transfrom.matrix3D property.
    The latter property holds all the information about the current 3D state
    of 'spSphere'.
    var spSphere:Sprite=new Sprite();
    board.addChild(spSphere);
    spSphere.x=0;
    spSphere.y=0;
    //We move 'spSphere' backwards to avoid distortion of the front thumbnails.
    //You can experiment with different values for the z coordinate.
    spSphere.z=rad;
    //We call several functions defined later in the script.
    //They names tell it all.
    setUpPics();
    buildSphere();
    spSphere.rotationY=0;
    spSphere.rotationX=0;
    spSphere.rotationZ=0;
    spSphere.filters=[new GlowFilter(0x666666,1.0,6.0,6.0,2)];
    rotateSphere(0,0,0);
    setUpListeners();
    //The function that draws the black rectangle behind our sphere.
    //You can change the values below to change the size and the color
    //of the background. Those values do not affect the sphere itself.
    function drawBoard():void {
          board.graphics.clear();
          board.graphics.lineStyle(0,0x333333);
          board.graphics.beginFill(0x000000, 0);
          board.graphics.drawRect(-640,-490,1180,1080);
          board.graphics.endFill();
    //We add all the necassary listeners. They are self-explanatory.
    //Note that holdersArray[i][j] is the Sprite that contains the
    //j-th thumbnail on the i-th circle.
    function setUpListeners():void {
              var i:int;
              var j:int;
              this.addEventListener(Event.ENTER_FRAME,autoRotate);
              board.addEventListener(MouseEvent.ROLL_OUT,boardOut);
              board.addEventListener(MouseEvent.MOUSE_MOVE,boardMove);
              board.addEventListener(MouseEvent.MOUSE_DOWN,boardDown);
              board.addEventListener(MouseEvent.MOUSE_UP,boardUp);
              loader.contentLoaderInfo.addEventListener(Event.COMPLETE,doneLoad);
              loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,loadingError);
              photoHolder.addEventListener(MouseEvent.CLICK,holderClicked);
             for(i=0;i<7;i++){
                for(j=0;j<jLen[i];j++){
                    holdersArray[i][j].doubleClickEnabled=true;
                    holdersArray[i][j].addEventListener(MouseEvent.DOUBLE_CLICK,picClicked);
    The functions that are executed in response to events to which we listen.
    The next one runs when a loaded picture is clicked.
    function holderClicked(e:MouseEvent):void {
        board.visible=true;
        photoHolder.visible=false;
        infoBox.text="";
        manualOn=false;
        autoOn=true;
    'picClicked' is executed when any of the thumbnails is double-clicked.
    Note that in the function 'buildSphere' below, we assigned names to
    all holders, holderArray[i][j]. We need those names now to know
    which thumbnail was clicked and which image to load.
    function picClicked(e:MouseEvent):void {
        var targName:String="Double Click Image To View";
        var i:int;
        var j:int;
        targName=e.currentTarget.name;
        i=int(targName.charAt(3));
        j=int(targName.substring(5,targName.length));
        board.visible=false;
        loader.load(new URLRequest(picsArray[i][j]));
        infoBox.text="";
        loadBox.text="Loading...";
        loadBox.visible=true;
    function loadingError(e:IOErrorEvent):void {
        loadBox.text="There has been an error loading the image. The server may be busy. Refresh the page and try again.";
    function doneLoad(e:Event):void {
        infoBox.text="Click the image to close it.";
        photoHolder.visible=true;
        loadBox.text="";
        loadBox.visible=false;
    //Listeners responsible for mouse rotations and auto-rotation.
    function autoRotate(e:Event):void {
             if(autoOn && !manualOn){
                 spSphere.transform.matrix3D.prependRotation(-0.5,Vector3D.Y_AXIS);
                 zSortPics();
    function boardOut(e:MouseEvent):void {
                autoOn=true;
                manualOn=false;
    function boardDown(e:MouseEvent):void {           
                prevX=board.mouseX;
                prevY=board.mouseY;
                autoOn=false;
                manualOn=true;
    function boardUp(e:MouseEvent):void {
                manualOn=false;
         function boardMove(e:MouseEvent):void {
                    var locX:Number=prevX;
                    var locY:Number=prevY;
                    if(!autoOn && manualOn){
                    prevX=board.mouseX;
                    prevY=board.mouseY;
                    rotateSphere(prevY-locY,-(prevX-locX),0);
                    e.updateAfterEvent();
    The function setUpPics populates the arrays thumbsArray and picsArray.
    Note the organization of thumbnails by circles on which they reside:
    thumbsArray[0] - the north pole, thumbsArray[1] thumbnails of the first circle
    down from the north pole, etc. 'picsArray' is organized similarly.
    You can, of course, subsitute your own images, use thumbnails of
    dimensions different from ours. Changing the number of thumbnails and their organization
    would, however, require rewritting the script a bit.
    function setUpPics():void {
        thumbsArray[0]=[new Bitmap(new Small1(70,46))];
        picsArray[0]=["pic1.jpg"];
        thumbsArray[1]=[new Bitmap(new Small2(70,105)),new Bitmap(new Small3(70,105)),new Bitmap(new Small4(70,53)),new Bitmap(new Small5(70,53)),new Bitmap(new Small6(70,53)),new Bitmap(new Small7(70,53))];
        picsArray[1]=["pic2.jpg","pic3.jpg","pic4.jpg","pic5.jpg","pic6.jpg","pic7.jpg"];
        thumbsArray[2]=[new Bitmap(new Small8(70,53)),new Bitmap(new Small9(70,53)),new Bitmap(new Small10(70,53)),new Bitmap(new Small11(70,53)),new Bitmap(new Small12(70,53)),new Bitmap(new Small13(70,53)),new Bitmap(new Small14(70,53)),new Bitmap(new Small15(70,53)),new Bitmap(new Small16(70,53)),new Bitmap(new Small17(70,53))];
        picsArray[2]=["pic8.jpg","pic9.jpg","pic10.jpg","pic11.jpg","pic12.jpg","pic13.jpg","pic1 4.jpg","pic15.jpg","pic16.jpg","pic17.jpg"];
        thumbsArray[3]=[new Bitmap(new Small18(70,53)),new Bitmap(new Small19(70,53)),new Bitmap(new Small20(70,53)),new Bitmap(new Small21(70,53)),new Bitmap(new Small22(70,53)),new Bitmap(new Small23(70,53)),new Bitmap(new Small24(70,53)),new Bitmap(new Small25(70,53)),new Bitmap(new Small26(70,53)),new Bitmap(new Small27(70,53)),new Bitmap(new Small28(70,53)),new Bitmap(new Small29(70,53))];
        picsArray[3]=["pic18.jpg","pic19.jpg","pic20.jpg","pic21.jpg","pic22.jpg","pic23.jpg","pi c24.jpg","pic25.jpg","pic26.jpg","pic27.jpg","pic28.jpg","pic29.jpg"];
        thumbsArray[4]=[new Bitmap(new Small30(70,53)),new Bitmap(new Small31(70,53)),new Bitmap(new Small32(70,53)),new Bitmap(new Small33(70,53)),new Bitmap(new Small34(70,53)),new Bitmap(new Small35(70,53)),new Bitmap(new Small36(70,53)),new Bitmap(new Small37(70,53)),new Bitmap(new Small38(70,53)),new Bitmap(new Small39(70,53))];
        picsArray[4]=["pic30.jpg","pic31.jpg","pic32.jpg","pic33.jpg","pic34.jpg","pic35.jpg","pi c36.jpg","pic37.jpg","pic38.jpg","pic39.jpg"];
        thumbsArray[5]=[new Bitmap(new Small40(70,53)),new Bitmap(new Small41(70,53)),new Bitmap(new Small42(70,53)),new Bitmap(new Small43(70,53)),new Bitmap(new Small44(70,53)),new Bitmap(new Small45(70,53))];
        picsArray[5]=["pic40.jpg","pic41.jpg","pic42.jpg","pic43.jpg","pic44.jpg","pic45.jpg"];
        thumbsArray[6]=[new Bitmap(new Small46(70,53))];
        picsArray[6]=["pic46.jpg"];
    In the next function we actually create a 3D sphere of thumbnails by positioning
    them in 3D within spSphere. Note the center of the sphere is at (0,0,0) of
    spSphere. It might be worth recalling that with our interpretation of
    phi and theta each point P=(x,y,z) on the sphere corresponding to given values
    of phi and theta is given by:
    x = rad * sin(phi) * sin(theta),
    y = -rad * cos(phi),
    z = -rad * sin(phi) * cos(theta).
    Within the function, we populate 'holdersArray' and 'midsArray'. We assign thumbnails
    to holdersArray elements, position holdersArray elements, tilt them, give them names.
    We literally build our sphere.
    function buildSphere():void {
        var i:int;
        var j:int;
        var tStep:Number;
        var pStep:Number=phiStep*Math.PI/180;
        for(i=0;i<7;i++){
            holdersArray[i]=[];
            midsArray[i]=[];
            tStep=thetaStep[i]*Math.PI/180;
            for(j=0;j<jLen[i];j++){
                midsArray[i][j]=new Vector3D(rad*Math.sin(i*pStep)*Math.sin(j*tStep),-rad*Math.cos(i*pStep),-rad*Math.sin(i*p Step)*Math.cos(j*tStep));
                holdersArray[i][j]=new Sprite();
                holdersArray[i][j].name="pic"+String(i)+"_"+String(j);
                holdersArray[i][j].addChild(thumbsArray[i][j]);
                thumbsArray[i][j].x=-thumbWidth/2;
                thumbsArray[i][j].y=-thumbHeight/2;
                spSphere.addChild(holdersArray[i][j]);
                holdersArray[i][j].x=midsArray[i][j].x;
                holdersArray[i][j].y=midsArray[i][j].y;
                holdersArray[i][j].z=midsArray[i][j].z;
                holdersArray[i][j].rotationX=phiTilt[i];
                holdersArray[i][j].rotationY=-j*thetaStep[i];
          zSortPics();
    'zSortPics' depth-sorts all thumbnails corresponding to each view of
    the sphere. It sorts thumbnails by removing them (or more precisely
    their holders, holdersArray[i][j], as children of spSphere and then reassigning
    them based on the z-coordinates of their midpoints.
    function zSortPics():void {
        var distArray:Array=[];
        var dist:Number;
        var i:int;
        var j:int;
        var k:int;
        var curMatrix:Matrix3D;
        var curMid:Vector3D;
        curMatrix=spSphere.transform.matrix3D.clone();
        while(spSphere.numChildren>0){
            spSphere.removeChildAt(0);
            for(i=0;i<7;i++){
                for(j=0;j<jLen[i];j++){
                curMid=curMatrix.deltaTransformVector(midsArray[i][j]);
                dist=curMid.z;
                distArray.push([dist,i,j]);
          distArray.sort(byDist);
          for(k=0;k<distArray.length;k++){
              spSphere.addChild(holdersArray[distArray[k][1]][distArray[k][2]]);
              holdersArray[distArray[k][1]][distArray[k][2]].alpha=Math.max(k/(distArray.length-1),0.5) ;
    function byDist(v:Array,w:Array):Number {
         if (v[0]>w[0]){
            return -1;
          } else if (v[0]<w[0]){
            return 1;
           } else {
            return 0;
    The function that rotates the sphere in response to the user moving the mouse.
    Note we are setting the z coordinate to 0 before rotation. Otherwise,
    the non-zero translation coefficients produce undesirable effects.
    Note also that we do not use this function in 'autoRotate'. That is because
    when the sphere auto-rotates we want it to revolve about is pole-to-pole
    axis. That means prepending rather than appending rotation.
    See the function 'autoRotate' above.
    function rotateSphere(rotx:Number,roty:Number,rotz:Number):void {
          spSphere.z=0;
          spSphere.transform.matrix3D.appendRotation(rotx,Vector3D.X_AXIS);
          spSphere.transform.matrix3D.appendRotation(roty,Vector3D.Y_AXIS);
          spSphere.transform.matrix3D.appendRotation(rotz,Vector3D.Z_AXIS);
          spSphere.z=rad;
          zSortPics();

    I won't be searching thru all that code to try to find something relevant to your post, but if you are using a Loader to load the images, you can get the width and height as soon as the loading is complete using the loader object (loader.width, loader.height).  You just need to wait until loading is complete, so you'll need a listener for that if you don't have one already.

  • 3D tag cloud for Flex

    I'm trying to use this one class to create the tag cloud to flex.
    1.I created a master document.
    ?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx"
        creationComplete="init();" minWidth="955" minHeight="600" xmlns:local="*">
    <fx:Script>
    <![CDATA[
    import mx.core.IVisualElement;
    import mx.core.UIComponent;
    public var inputWordr:String = "";
    private function init():void {
    c20.addElement(tirs as IVisualElement);
    ]]>
    </fx:Script>
    <fx:Declarations>
    <local:MyComponent id="tirs" x="0" y="0" width="300" height="300"/>
    </fx:Declarations>
    <s:BorderContainer x="10" y="38" width="542" height="428" id="c20">
    </s:BorderContainer>
    </s:Application>
    2. And created a class (MyComponent.as) based on code from the example and import all required swc.
    package
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.filters.BitmapFilterQuality;
    import flash.filters.BlurFilter;
    import flash.filters.GlowFilter;
    import flash.text.TextField;
    import mx.core.UIComponent;
    import org.papervision3d.core.geom.Particles;
    import org.papervision3d.core.geom.renderables.Particle;
    import org.papervision3d.events.InteractiveScene3DEvent;
    import org.papervision3d.materials.special.BitmapParticleMaterial;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.view.BasicView;
    public class MyComponent extends Sprite
    private var scale:Number = 5;
    private var radius:Number = 350;
    private var smoothing:Boolean = true;
    private var minAlpha:Number = 0.3;
    private var glow:GlowFilter;
    private var tags:Array;
    private var tag_num:uint;
    private var bv:BasicView;
    private var tagArray:Array;
    private var tagContainer:DisplayObject3D;
    public function MyComponent()
    init ();
    private function init ():void {
    glow = new GlowFilter (0x003366, 1, 8, 8, 2, BitmapFilterQuality.LOW, true, false);
    tags = ["free","news","Cookie","practice","JavaScript","toy","life","something","LocalConnection ","memo","MSN","funny", "ActionScript 3", "Food", "Book", "Photo", "favorite"];
    tag_num = tags.length;
    tagArray = [];
    tagContainer = new DisplayObject3D ("tag_container");
    tagContainer.x = -radius * 0.25;
    tagContainer.y =  radius * 0.25;
    bv = new BasicView (300, 300, true, true);
    bv.viewport.interactive = true;
    bv.scene.addChild (tagContainer);
    bv.camera.z = -2 * radius;
    bv.camera.zoom = 20;
    bv.startRendering ();
    addChild (bv);
    buildTags ();
    addEventListener (Event.ENTER_FRAME, enterFrameHandler);
    private function buildTags ():void {
    var i:uint;
    for (i = 0; i < tag_num; i++) {
    // 2D
    var txt:TextField = new TextField ();
    txt.text = tags[i];
    txt.filters = [new BlurFilter(1.1, 1.1)];
    var txtW:Number = txt.textWidth + 4;
    var txtH:Number = txt.textHeight + 4;
    var bitmap:BitmapData = new BitmapData (txtW, txtH, true, 0x01FFFFFF);
    bitmap.draw (txt);
    var phi:Number = Math.acos((2 * (i + 1) - 1) / tag_num - 1);
    var theta:Number = Math.sqrt(tag_num * Math.PI) * phi;
    // 3D
    var material:BitmapParticleMaterial = new BitmapParticleMaterial (bitmap);
    material.interactive = true;
    material.smooth = smoothing;
    var tag:Particle = new Particle (material, scale, 0, 0, 0);
    var tagHolder:Particles = new Particles ("tag_");
    tagHolder.addParticle (tag);
    tagHolder.x = radius * Math.cos (theta) * Math.sin (phi);
    tagHolder.y = radius * Math.sin (theta) * Math.sin (phi);
    tagHolder.z = radius * Math.cos (phi);
    tagHolder.useOwnContainer = true;
    tagHolder.autoCalcScreenCoords = true;
    tagHolder.addEventListener (InteractiveScene3DEvent.OBJECT_OVER, objectOverHandler);
    tagHolder.addEventListener (InteractiveScene3DEvent.OBJECT_OUT, objectOutHandler);
    //tagHolder.addEventListener (InteractiveScene3DEvent.OBJECT_PRESS, objectPressHandler);
    tagContainer.addChild (tagHolder);
    tagArray.push (tagHolder);
    private function objectOverHandler (e:InteractiveScene3DEvent):void {
    bv.viewport.buttonMode = true;
    e.target.filters = [glow];
    private function objectOutHandler (e:InteractiveScene3DEvent):void {
    bv.viewport.buttonMode = false;
    for (var j:uint = 0; j < tag_num; j++) {
    tagArray [j].filters = [];
    private function enterFrameHandler (e:Event):void {
    tagContainer.rotationX += (mouseY - 300 * 0.5) * 0.01;
    tagContainer.rotationY += (mouseX - 300 * 0.5) * 0.01;
    for (var j:uint = 0; j < tag_num; j++) {
    tagArray[j].alpha = minAlpha + (1 - minAlpha) * (1 - (tagArray[j].screen.z - radius) / (2 * radius));
    3. Then I created a call of custom component, but nothing is displayed or causes errors. I tried to insert this component in different ways.
    Check out where I made mistakes, please.

    all i could find...
    http://www.ericd.net/tagCloud/

  • How to unload externally loaded swf which contains 3D Carousel?

    Hello to all
    I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
    I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at carousel_c_fla::MainTimeline/moveCarousel()
    this error repeats over and over again slowing my swf movie.
    So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
    If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
    I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
    //Import TweenMax
    import com.greensock.*;
    //The path to the XML file (use your own here)
    // old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
    var xmlPath:String = "carousel-menu.xml";
    //We'll store the loaded XML to this variable
    var xml:XML;
    //Create a loader and load the XML. Call the function "xmlLoaded" when done.
    var loader = new URLLoader();
    loader.load(new URLRequest(xmlPath));
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    //This function is called when the XML file is loaded
    function xmlLoaded(e:Event):void {
         //Make sure that we are not working with a null variable
         if ((e.target as URLLoader) != null ) {
              //Create a new XML object with the loaded XML data
              xml = new XML(loader.data);
              //Call the function that creates the menu
              createMenu();
    //We need to know how many items we have on the stage
    var numberOfItems:uint = 0;
    //This array will contain all the menu items
    var menuItems:Array = new Array();
    //Set the focal length
    var focalLength:Number = 350;
    //Set the vanishing point
    var vanishingPointX:Number = stage.stageWidth / 2;
    var vanishingPointY:Number = stage.stageHeight / 2;
    //We calculate the angleSpeed in the ENTER_FRAME listener
    var angleSpeed:Number = 0;
    //Radius of the circle
    var radius:Number = 128;
    //This function creates the menu
    function createMenu():void {
         //Get the number of menu items we will have
         numberOfItems = xml.items.item.length();
         //Calculate the angle difference between the menu items (in radians)
         var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
         //We use a counter so we know how many menu items have been created
         var count:uint = 0;
         //Loop through all the <button></button> nodes in the XML
         for each (var item:XML in xml.items.item) {
              //Create a new menu item
              var menuItem:MenuItem = new MenuItem();
              //Calculate the starting angle for the menu item
              var startingAngle:Number = angleDifference * count;
              //Set a "currentAngle" attribute for the menu item
              menuItem.currentAngle = startingAngle;
              //Position the menu item
              menuItem.xpos3D = 0;
              menuItem.ypos3D = radius * Math.sin(startingAngle);
              menuItem.zpos3D = radius * Math.cos(startingAngle);
              //Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
              var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
              //Scale the menu item according to the scale ratio
              menuItem.scaleX = menuItem.scaleY = scaleRatio;
              //Position the menu item to the stage (from 3D to 2D coordinates)
              menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
              menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
              //Add a text to the menu item
              menuItem.menuText.text = item.label;
              //Add a "linkTo" variable for the URL
              menuItem.linkTo = item.linkTo;
              //We don't want the text field to catch mouse events
              menuItem.mouseChildren = false;
              //Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
              menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
              menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
              menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
              //Add the menu item to the menu items array
              menuItems.push(menuItem);
              //Add the menu item to the stage
              addChild(menuItem);
              //Assign an initial alpha
              menuItem.alpha = 0.3;
              //Add some blur to the item
              TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
              //Update the count
              count++;
    //Add an ENTER_FRAME listener for the animation
    addEventListener(Event.ENTER_FRAME, moveCarousel);
    //This function is called in each frame
    function moveCarousel(e:Event):void {
         //Calculate the angle speed according to mouseY position
         angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
         //Loop through the menu items
         for (var i:uint = 0; i < menuItems.length; i++) {
              //Store the menu item to a local variable
              var menuItem:MenuItem = menuItems[i] as MenuItem;
              //Update the current angle of the item
              menuItem.currentAngle += angleSpeed;
              //Calculate a scale ratio
              var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
              //Scale the item according to the scale ratio
              menuItem.scaleX=menuItem.scaleY=scaleRatio;
              //Set new 3D coordinates
              menuItem.xpos3D=0;
              menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
              menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
              //Update the item's coordinates.
              menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
              menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
         //Call the function that sorts the items so they overlap each other correctly
         sortZ();
    //This function sorts the items so they overlap each other correctly
    function sortZ():void {
         //Sort the array so that the item which has the highest
         //z position (= furthest away) is first in the array
         menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
         //Set new child indexes for the item
         for (var i:uint = 0; i < menuItems.length; i++) {
              setChildIndex(menuItems[i], i);
    //This function is called when a mouse is over an item
    function mouseOverItem(e:Event):void {
         //Tween the item's properties
         TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
    //This function is called when a mouse is out of an item
    function mouseOutItem(e:Event):void {
         //Tween the item's properties
         TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
    //This function is called when an item is clicked
    function itemClicked(e:Event):void {
         //Navigate to the URL that's assigned to the menu item
         var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
         navigateToURL(urlRequest);

    Hi Ned thanks for the reply,
    Ok so I have a button in my main movie that loads the external swf
    stop();
    var my_loader:Loader = new Loader();
    var my_btn:Button = new Button();
    var my_pb:ProgressBar = new ProgressBar();
    my_pb.source = my_loader.contentLoaderInfo;
    my_btn.addEventListener(MouseEvent.CLICK,startLoading);
    function startLoading(e:MouseEvent):void{
    my_loader.load(new URLRequest("carousel.swf"));
    addChild(my_pb);
    my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
    function finishloading(e:Event):void{
    addChild(my_loader);
    my_loader.addEventListener("killMe",
    killLoadedClip);
    removeChild(my_pb);
    function killLoadedClip(e:Event):void {
    my_loader.removeEventListener("killMe",
    killLoadedClip);
    my_loader.unloadAndStop();
    removeChild(my_loader);
    Then I have a button in my loaded swf that closes the loader
    This is spread over 2 frames
    Frame1
    function closeIt(e:MouseEvent):void {
    parent.dispatchEvent(newEvent("killMe"));
    Frame 2
    back_btn.addEventListener(MouseEvent.CLICK, closeIt);
    Frame 2 also holds all the code for the carousel
    Thanks for your time and help in advance people ; )

  • Flex 4: Custom ScrollBar not working in Custom DropDownList

    Hello,
    I'm having an odd issue that I just cannot figure out. I have a custom DropDownList .as component (to pass color values) and a custom skin. In this skin I am using a custom Scroller (same AS file component with mxml skin). When I use this configuration, clicking on the scrollbar just closes the DropDown. If I remove the skin from my custom scrollbar it works, which leads me to believe it has something to do with the DropDown skin. Even if I revert my custom Scroller to the spark Scroller, it still doesn't work. I've narrowed it down to what seems like a problem with my DropDownList skin.
    Not really sure what code to put here, but all I've been doing is right clicking my project and making new ActionScript components and MXML skins from the default skin. Here is my DropDownList skin, not sure if I should paste any other code? I have no idea what would be causing this, so I don't really know what code to place.
          [HostComponent("ccm.DropDown.DropDownList")]          

    Woops, the code didn't place correctly, here it is:
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:fb="http://ns.adobe.com/flashbuilder/2009" alpha.disabled=".5" xmlns:Scroller="ccm.Scroller.*" xmlns:DropDown="ccm.DropDown.*">
        <fx:Metadata>
              [HostComponent("ccm.DropDown.DropDownList")]
         </fx:Metadata>
        <!-- host component -->
         <fx:Script fb:purpose="styling">
              <![CDATA[           
                   import flash.filters.BitmapFilterQuality;
                   import flash.filters.BitmapFilterType;
                   import mx.controls.Alert;
                   import spark.filters.*;
                   /* Define the content fill items that should be colored by the "contentBackgroundColor" style. */
                   static private const contentFill:Array = [];
                    * @private
                   override public function get contentItems():Array {return contentFill};
                    * @private
                   override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                        openButton.setStyle("cornerRadius", getStyle("cornerRadius"));
                        super.updateDisplayList(unscaledWidth, unscaledHeight);
              ]]>
         </fx:Script>
         <s:states>
              <s:State name="normal" />
              <s:State name="open" />
              <s:State name="disabled" />
         </s:states>
         <!---
         The PopUpAnchor control that opens the drop-down list.
         <p>In a custom skin class that uses transitions, set the
         <code>itemDestructionPolicy</code> property to <code>none</code>.</p>
         -->
         <s:PopUpAnchor id="popUp"  displayPopUp.normal="false" displayPopUp.open="true" includeIn="open"
                           left="0" right="0" top="0" bottom="0" itemDestructionPolicy="auto"
                           popUpPosition="below" popUpWidthMatchesAnchorWidth="true" >
              <!---
              This includes borders, background colors, scrollers, and filters.
              @copy spark.components.supportClasses.DropDownListBase#dropDown
              -->
              <s:Group maxHeight="134" minHeight="22" >
                   <s:Rect id="fill" left="1" right="1" top="1" bottom="0" bottomLeftRadiusX="16.5" bottomRightRadiusX="16.5" topLeftRadiusX="16.5" topRightRadiusX="16.5" >
                        <s:fill>
                             <s:SolidColor color="0xFFFFFF" />
                        </s:fill>
                        <s:filters>
                             <s:GlowFilter
                                  color="0x000000"
                                  alpha=".35"
                                  blurX="6"
                                  blurY="6"
                                  strength="1"
                                  quality="{BitmapFilterQuality.HIGH}"
                                  inner="true"
                                  knockout="false"/>
                        </s:filters>
                   </s:Rect>
                   <!--- @private -->
                   <Scroller:Scroller id="scroller" left="8" top="8" right="8" bottom="8" hasFocusableChildren="false" minViewportInset="1"
                                          showButtons="false"
                                          trackColor="{hostComponent._trackColor}"
                                          thumbColor="{hostComponent._thumbColor}"
                                          skinClass="ccm.Scroller.ScrollerSkin">
                        <!--- @copy spark.components.SkinnableDataContainer#dataGroup-->
                        <s:DataGroup id="dataGroup" itemRenderer="ccm.DropDown.DropDownItemRenderer">
                             <s:layout>
                                  <s:VerticalLayout gap="0" horizontalAlign="contentJustify"/>
                             </s:layout>
                        </s:DataGroup>
                   </Scroller:Scroller>
              </s:Group>
         </s:PopUpAnchor>
         <!---  The default skin is DropDownListButtonSkin.
         @copy spark.components.supportClasses.DropDownListBase#openButton
         @see spark.skins.spark.DropDownListButtonSkin -->
         <DropDown:DropDownButton id="openButton" left="0" right="0" top="0" bottom="0" focusEnabled="false"
                                        skinClass="ccm.DropDown.DropDownButtonSkin"
                                        buttonColor="{hostComponent._buttonColor}"
                                        /> 
         <!--- @copy spark.components.DropDownList#labelDisplay -->
         <s:Label id="labelDisplay" verticalAlign="middle" maxDisplayedLines="1"
                    mouseEnabled="false" mouseChildren="false"
                    left="12" right="30" top="2" bottom="2" width="75" verticalCenter="1" />
    </s:SparkSkin>

  • Movieclip

    i need to display this dynamically generating buttons from xml into moveclip with scrollbar in as3 pls help me....................i had attached my code...
    var yPlacement:int = 230;
    var xPlacement:int = 66;
    var distance:int = 100;
    var format:TextFormat = new TextFormat();
    format.color = 0x000000;
    format.font = "Verdana";
    format.size = 18;
    format.bold = true;
    //format.kerning = false;
    //var items:Array = new Array();
    var myXML:XML = new XML();
    var XML_URL:String = "evs.xml";
    var myXMLURL:URLRequest = new URLRequest(XML_URL);
    var myLoader:URLLoader = new URLLoader(myXMLURL);
    myLoader.addEventListener("complete", xmlLoaded);
    // Create the xmlLoaded function
    function xmlLoaded(event:Event):void {
    // Place the xml data into the myXML object
        myXML = XML(myLoader.data);
        // Initialize and give var name to the new external XMLDocument
    var xmlDoc:XMLDocument = new XMLDocument();
    // Ignore spacing around nodes
        xmlDoc.ignoreWhite = true;
    // Define a new name for the loaded XML that is the data in myLoader
        var menuXML:XML = XML(myLoader.data);
    // Parse the XML data into a readable format
        xmlDoc.parseXML(menuXML.toXMLString());
    // Set the index number of our loop, increments automatically
    var i:Number = 0;
    // Run the "for each" loop to iterate through all of the menu items listed in the external XML file
    for each (var topic:XML in myXML..topic) {
    // Access the value of the "itemLabel" node in our external XML file
        var listLabel:String = topic.itemLabel.toString();
    // Access the value of the "urlstring" node in our external XML file
        var listurl:String = topic.urlstring.toString();
    // Just some trace I used while testiing
    //trace(listurl);
                             // This all pertains to the style of the button, alter values to your liking
                             var type:String = GradientType.LINEAR;
                             var colors:Array = [0xFFFFFF, 0xCCCCCC];
                             var alphas:Array = [1, 1];
                             var ratios:Array = [0, 255];
                             var spreadMethod:String = SpreadMethod.PAD;
                             var interp:String = InterpolationMethod.LINEAR_RGB;
                             var focalPtRatio:Number = 0;
                             var matrix:Matrix = new Matrix();
                             var boxWidth:Number = 200;
                             var boxHeight:Number = 40;
                             var boxRotation:Number = Math.PI/2; // 90˚
                             var tx:Number = 0;
                             var ty:Number = 0;
                             matrix.createGradientBox(boxWidth, boxHeight, boxRotation, tx, ty);
                             var rect:Shape = new Shape;
                             rect.graphics.beginGradientFill(type, colors, alphas, ratios, matrix, spreadMethod, interp, focalPtRatio);
    rect.graphics.lineStyle(1, 0x999999);
                             rect.graphics.drawRect(0, 0, 200, 40);
             // This all pertains to the text fields that give our buttons their label, alter values to your liking
                             var myText:TextField = new TextField();
    //myText.embedFonts = true;
                                 myText.autoSize = TextFieldAutoSize.CENTER;
                                 myText.antiAliasType = AntiAliasType.ADVANCED;
                             myText.defaultTextFormat = format;
                             myText.selectable = false;
                             myText.mouseEnabled = false;
                             myText.text = listLabel;
    myText.x = 2;
    myText.y = 2;
                             addChild(myText);
                         // Create MovieClip holder for each button graphic and text label
                      var clip_mc = new MovieClip();
    // Add the rectangle graphic
                         layout_mc.clip_mc.addChild(rect);
    // Add the text field
                         layout_mc.clip_mc.addChild(myText);
    // Put the new movieClip on stage now
                         addChild(clip_mc);
    // Make the mouse button mode true for the movieclip so user knows it is a button
                        layout_mc.clip_mc.buttonMode = true;
    // Offset each one in the loop to make sure they don't just get put right on top of each other
    yPlacement = yPlacement + 50;
    // Now apply it in its offset Y position to the stage
    layout_mc.clip_mc.y = yPlacement;
    // X position it will be placed on stage
                        layout_mc.clip_mc.x = xPlacement;          
    // Access the URL value and ready it for setting up the Click listener, and function
                                 layout_mc.clip_mc.clickToPage = listurl;
    // Add the mouse event listener to the moviClip button
                                 layout_mc.clip_mc.addEventListener (MouseEvent.CLICK, clipClick);
                                 //Add event listeners (used for animating the buttons)
                         layout_mc.clip_mc.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);
                         layout_mc.clip_mc.addEventListener (MouseEvent.MOUSE_OUT, onMouseOut);
                                 // Set the function for what happens when that button gets clicked
                                 function clipClick(e:Event):void {
                                    var targetURL:String = e.target.clickToPage;
                                    var urlRequest:URLRequest = new URLRequest(targetURL);
                                    navigateToURL(urlRequest);
                                 i++;
    // Set the mouse over function for all movieclip buttons
    function onMouseOver (e:Event):void {
    // Create the filters and add them to an array
    var bevel:BevelFilter = new BevelFilter();
    bevel.distance = 1;
    bevel.angle = 45;
    bevel.shadowColor = 0x666666;
    bevel.shadowAlpha = 0.5;
    bevel.strength = 4;
    bevel.quality = BitmapFilterQuality.MEDIUM;
    bevel.type = BitmapFilterType.INNER;
    bevel.knockout = false;
    var glow:GlowFilter = new GlowFilter();
    glow.color = 0x79B3E1;
    glow.alpha = 1;
    glow.quality = BitmapFilterQuality.MEDIUM;
    // Pack the filter paramters into the array variable
    var filtersArray:Array = new Array(bevel, glow);
    // Assign the filters array to the display object to apply the filter
    e.target.filters = filtersArray;
    // Set the mouse out function for all movieclip buttons
    function onMouseOut (e:Event):void {
        // Remove the Filters on Mouse Out
    e.target.filters = null;

    NEVER MIND! I found my error. I forgot that I should have
    imported MouseEvent instead of Event. I like this new way of doing
    things. LOL

  • Customizing List Selection Indication

    Hello Everyone,
       I would like to customize the way the List shows a selected item.  The default implementation is to highlight the background.  I would like to change that to a glow filter around the border.  The default implementation for the "ItemRenderer" class has a draw background method, but that is marked internal and private.  There is a skin state "selected", but when I go to create a custom skin. ItemRenderer does not pop up in the autocomplete class search leading me to believe I may be going down the wrong path.  Any help is greatly appreciated, I am using SDK4.0 if that is any help.

    All of the visuals of a selected item are handled in the item renderer.  Are you able to create a custom ItemRenderer that does what you are looking for?
    <s:ItemRenderer glowFilter="{myGlow}"...>
        <s:Label text="{data}" />
    </s:ItemRenderer>

  • Glow filters and tween class does not work!!

    hi!!!! this is my problem...
    I have inserted on stage through attachmovie a mc and copied
    6 times through the cycle for. . now through the class filter I
    have assigned for everyone the effect always through the cilo for,
    but I do not succeed to assign transition that is to the effect
    movement of the filter glow to all the mc
    for all the rollOut and rollOver works (this is looked at
    from the small hand and trace) but the every time that step small
    hand on whichever only mc to a part the transition of the
    effect…
    now i show the code of my fla files that is in first frame...
    quote:
    import flash.filters.GlowFilter;
    /*import flash.filters.*;*/
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    //imposto le variabili posizione
    var posX:Number = 80;
    var posY:Number = 370;
    //creo l'array di testo delle icone e del numero delle icone
    var testoIco:Array = new Array ("VIDEO","MOTION
    GRAPHICS","WEB SITES","ILLUSTRATIONS","BRAND","PHOTO");
    setUpButtons();
    function setUpButtons()
    var gf:GlowFilter = new GlowFilter(0x000000, 100, 0, 0, 3,
    3, false, false);
    //dichiaro gli effetti e li imposto
    var blurXTween:Tween = new Tween(gf, "blurX",
    Elastic.easeOut, 5, 5, 1, true);
    var blurYTween:Tween = new Tween(gf, "blurY",
    Elastic.easeOut, 5, 5, 1, true);
    //imposto il valore btnCnt
    var btnCnt = testoIco.length;
    /*ciclo for per attaccare il simbolo item dalla libreria e
    per moltiplicarlo
    sullo stage e dargli l'effetto*/
    for(var i=0; i < btnCnt; i++)
    //attacco l'icona dalla libreria
    var icon:MovieClip = this.attachMovie("icon","icon" + i,
    i+1);
    var temp = this["icon"+i];
    temp.icona.testo.textButton = testoIco
    temp._x = (127*i) + posX;
    temp._y = posY;
    temp.ref.setMask(temp.mask);
    var glow:Array = this["gf"+i];
    temp.filters = [gf];
    /*applico l'effetto alle icone rollOver rollOut*/
    temp.onRollOver = function ()
    blurXTween.continueTo(20, 2);
    blurYTween.continueTo(20, 2);
    temp.onRollOut = function ()
    blurXTween.continueTo(5, 2);
    blurYTween.continueTo(5, 2);
    blurXTween.onMotionChanged = function ()
    temp.filters = [gf];
    i need help!!!
    sorry for my bad english....

    Thanks jtahlborn for this fast reply.
    Unfortunately it doesn't work, if I change the code of WebServiceBean to the following:
    @Stateless
    public class WebServiceBean
         @EJB
         ControllerBean controller;
         @EJB
         JPAServiceLocal jpa;
    }Error message:
    javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name: com.x.y.z.ControllerBean
    Do I have to define any parameter with the @EJB annotation, like name or bean-name or put something into ejb-jar.xml?
    The second idea is not an option for me, I don't wanna make ControllerBean a POJO
    Cheers

Maybe you are looking for