Skip navigation
Currently Being Moderated

Create a User-Interactive Flash

Mar 4, 2013 1:05 PM

Tags: #flash

Is there any way I can create an interactive Flash with which the user can put X-marks on random locations of a picture? (e.g. X marking different locations on a map.)

 
Replies
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 4, 2013 1:40 PM   in reply to kvnrizzo1

    sure.

     

    but what's supposed to happen after those x's are placed?

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 4, 2013 5:41 PM   in reply to kvnrizzo1

    in flash:

     

    create a movie the looks like the X-mark you want to place on your map and assign it a class (eg, XMark).

     

    add your map to the stage and add the following to your actions panel:

     

    this.addEventListener(MouseEvent.CLICK,clickF);

    function clickF(e:MouseEvent):void{

    var xmark:XMark=new XMark();

    this.addChild(xmark);

    xmark.x=e.stageX;

    xmark.y=e.stageY;

    }

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 5, 2013 12:28 PM   in reply to kvnrizzo1

    open your fla with the XMark png in the library.  right click it>click properties>tick export for actionscript and assign the class name XMark if it's not already assigned>click ok.

     

    add your map to the stage and add the following to your actions panel:

     

    this.addEventListener(MouseEvent.CLICK,clickF);

    function clickF(e:MouseEvent):void{

    var xmark:XMark=new XMark();

    this.addChild(xmark);

    xmark.x=e.stageX;

    xmark.y=e.stageY;

    }

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 1:01 PM   in reply to kglad

    use:

     

     

    this.addEventListener(MouseEvent.CLICK,clickF);

    function clickF(e:MouseEvent):void{

    var xmark:XMark=new XMark();

    this.addChild(xmark);

    xmark.x=e.stageX;

    xmark.y=e.stageY;

    xmark.addEventListener(MouseEvent.CLICK,xmarkF);

    }

    function xmarkF(e:MouseEvent):void{
    e.currentTarget.removeEventListener(MouseEvent.CLICK,xmarkF);

    this.removeChild(e.currentTarget);

    }

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 1:49 PM   in reply to kvnrizzo1

    that makes no sense, if line 20 is one of the lines of code i suggested.

     

    which line is it?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 3, 2013 8:04 PM   in reply to kvnrizzo1

    This worked for me... giving the second function proximity to the variables etc: This was useful in that I didn't previously know how to get an MC directly from the library. Thanks MR K. although it is somewhat belated from the original post date

     

    stop();

    this.addEventListener(MouseEvent.CLICK,clickF);

    function clickF(e:MouseEvent):void {

         var keybut:keyMC=new keyMC();

         this.addChild(keybut);

         keybut.x=e.stageX;

         keybut.y=e.stageY;

         keybut.addEventListener(MouseEvent.CLICK,keybutF);

     

         function keybutF(e:MouseEvent):void {

              e.currentTarget.removeEventListener(MouseEvent.CLICK,keybutF);

              this.removeChild(e.currentTarget); // but it didn't like this bit either as e.currentTarget or keybut

         }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points