Jump to content
Search Community

hano

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by hano

  1. Thank you so much, the force selection worked perfectly, I'm still dabbling with the other part.

     

    i have one last question, when I try to rotate and scale the objects, the drawing functionality still works. Do the handles listen for events as well? I tried using the transform event listeners but it's still drawing all over the place. Is there something else I need to listen for?

     

    newSquare.addEventListener(TransformEvent.SEIZE_CURSOR, stopdraw);

    newSquare.addEventListener(TransformEvent.START_INTERACTIVE_SCALE, stopdraw);

    newSquare.addEventListener(TransformEvent.START_INTERACTIVE_MOVE, stopdraw);

    newSquare.addEventListener(TransformEvent.START_INTERACTIVE_ROTATE, stopdraw);

    newSquare.addEventListener(TransformEvent.FINISH_INTERACTIVE_SCALE, startdraw);

    newSquare.addEventListener(TransformEvent.FINISH_INTERACTIVE_MOVE, startdraw);

    newSquare.addEventListener(TransformEvent.FINISH_INTERACTIVE_ROTATE, startdraw);

    newSquare.addEventListener(TransformEvent.MOVE, stopdraw);

    newSquare.addEventListener(TransformEvent.SCALE, stopdraw);

    newSquare.addEventListener(TransformEvent.ROTATE, stopdraw);

     

    newSquare.addEventListener(MouseEvent.MOUSE_DOWN, stopdraw);

    newSquare.addEventListener(MouseEvent.MOUSE_UP, startdraw);

     

    function stopdraw(e:MouseEvent):void {

    stage.removeEventListener(MouseEvent.MOUSE_DOWN, startDrawing);

    drawIt = false;

     

    }

    function startdraw(e:MouseEvent):void {

     

    stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);

     

    drawIt = true;

    }

     

     

  2. Hi!

     

    I'm trying to create an interactive board for kids, and I seem to be having a problem with two things

    1. setting the transformable object's index

    2. deleting the objects off the stage when clicking on other frames

     

     

    The first problem is that when I'm adding shapes to the stage, they're being placed on top of menus etc, I want their index to be lowered.. by several depths, right now they're at 20 (tracing childindex) Is there a way to set their depth? I tried addChildAt but it didn't seem to work..Also tried moveSelectionDepthDown, and traced the child index but it didn't change.

     

    function addSquare(e:MouseEvent):void {

     

    addChild(newSquare);

    //addChildAt(newSquare,0);

    manager.addItem(newSquare);

    manager.moveSelectionDepthDown();

    manager.selectItem(newSquare);

    newSquare.buttonMode=true;

    }

     

     

    The second issue is deleting the shapes off the stage, I'm calling the code below when a clear all button is clicked, and it works perfectly fine. But I've also placed the same code on other frames, so that when the user navigates to another section without pressing on the clear all button, the shapes still won't show. However, if no shapes are already on the stage, I get a runtime error. Is there a way to know if the shapes are not the stage or not, before attempting to remove them? Or any easier way to do this?

     

     

    manager.selectItems(manager.items);

    manager.deleteSelection();

    manager.removeAllItems();

     

     

     

    Any help is appreciated, thank u!

  3. I think I don't have a selectedTargetObjects array, I suppose that's my problem? I'm not sure how to create one :/ I don't want all the shapes on the stage to change color, just the ones that are selected (handles on them)

     

    var newSquare:MovieClip;
    var newTriangle:MovieClip;
    
    var manager:TransformManager = new TransformManager({bounds:new Rectangle(0, 10, 800, 600)});
    
    square_mc.addEventListener(MouseEvent.CLICK, addSquare);
    Triangle_mc.addEventListener(MouseEvent.CLICK, addTriangle);
    
    
    function addSquare(e:MouseEvent):void {
       newSquare = new Square();
       newSquare.x = stage.x/2 + stage.width/2;
       newSquare.y = square_mc.y;
    
       addChild(newSquare);
       manager.addItem(newSquare);
       manager.selectItem(newSquare);
       
    }
    
    function addTriangle(e:MouseEvent):void {
       newTriangle = new Triangle();
       newTriangle.x = stage.width/2;
       newTriangle.y = stage.height/2;
    
       
       addChild(newTriangle);
       manager.addItem(newTriangle);
       manager.selectItem(newTriangle);    
       
    }
    
    
    colorpicker_mc.addEventListener(MouseEvent.CLICK, changetored);
    
    
    function changetored(e:MouseEvent)
    
    {
       TweenMax.allTo(manager.selectedTargetObjects, 1, {tint:0x000000});
       
    }

  4. Hi

     

    I'm trying to make an interactive whiteboard for kids, when the click on any shape from the menu a duplicate is added on the stage that can be transformed

     

    example of square adding function:

     

    square_mc.addEventListener(MouseEvent.CLICK, addSquare);
    
    
    function addSquare(e:MouseEvent):void {
    newSquare = new Square();
    newSquare.x = stage.x/2 + stage.width/2;
    
    
    addChild(newSquare);
    manager.addItem(newSquare);
    manager.selectItem(newSquare);
    
    

     

    and each new shape added is the selected one

     

    what i'd like to do is change the color of the selected item by clicking on a color palette , im currently using this code but its not working

     

     

    function changetored(e:MouseEvent)
    {
    
    TweenMax.to(manager.selectedItems, 1, {tint:0x000000});
    
    }

     

    any clues as to where I'm wrong?

     

    thanks!

  5. Hi :)

    I seem to have a problem with Transform Manager..

    I'm loading in new squares by clicking on the original square movieclip,, and I want the new squares to be transformable..

    Is there something wrong with my code?

    Any help appreciated!

     

    import com.greensock.transform.TransformManager;

    import com.greensock.events.TransformEvent;

     

    var newSquare:MovieClip;

    //this is the duplicate square variable

     

    var manager:TransformManager = new TransformManager({targetObjects:[newSquare], addItem:(newSquare),bounds:new Rectangle(0, 0, 550, 365)});

     

    square_mc.addEventListener(MouseEvent.CLICK, addSquare);

    //here im adding the new squares

     

    function addSquare(e:MouseEvent):void {

    newSquare = new Square();

    newSquare.x = stage.x/2 + stage.width/2;

    addChild(newSquare);

     

    newSquare.addEventListener(MouseEvent.MOUSE_DOWN, dragIt);

    newSquare.addEventListener(MouseEvent.MOUSE_UP, stopdragIt);

    }

×
×
  • Create New...