Slider & amp; Collision detection issue

I couldn't find anything to help solve my problem thanks to my various research and turned to the publication. First - I am strictly a fan and try to create a timeline of the biography of a genealogy site that I am building.
I have a scroll bar with a graph like the dredger pocket watch. What I hope to achieve, is that when the Watch has crept along the timeline and is is arrested on a marker (shown as a year), I'd like to pop up the relevant text on this date in time.

My cursor is a movieclip and markers of the year are buttons. Through my research, it seems that I need to use both the collision detection and a certain type of load a script attached to it. It is quite possible that I am too far from my skill level, but I wanted to tender hand in case there may be help for me.

I don't really have any code to show that I am very uncertain as to what would be the code appropriate to begin with. You can see an example of what I'm trying to accomplish here-> my scroll bar

I currently have the text attached to the "over" frame in the button for example.

Thank you in advance,
Randy

Hello

A quick solution to a situation that involves no collison detection must follow the x position of your clock instead, Minesweeper movieclip. You can use collision detection if you want, but by the way you set up your movie, it will involve a lot of targeting and recovery of the property. This track requires that you only add a few lines to a code you already have.

Follow these steps

(1) from the main stage, double-click your mc with the clock and the line in. Create a new layer and put 2 on that dynamic text boxes. Give the first instance of 'xpos' name text box and the other an instance name of "marker". XPos position near the bottom right of the scene and the marker on the opposite side. We will use these boxes for testing.

2) click on the Actions layer and look for the line that says:

ratio = Math.round (this._x);

This guy below

XPos.Text = report;

Test your movie and you should see your x on the lower post update when you drag the clock. By working? Well, that's what we want.

(3) according to the type of line last in what follows

space var = 3;

If (ratio > 36 - space & ratio)<>
Marker.Text = "1900";
} else
If (ratio > 172 - space & ratio)<>
Marker.Text = "1915";
} else
If (ratio > 399 - space & ratio)<>
Marker.Text = "1945";
}

OK - explanation - what is happening here is to check if the clock is on one of the markers and we send the right text to the other created textbox marker information previously. If you test your animation and drag toward the center of the 1900 marker you will see its position x is about 36. The space variable adds or subtracts 3 on this position so that we have a good size "struck the area. In other words, if the x position is between 33 and 39 while we are on the marker of 1900. 1915 marker is the same with the other two - between 169 and 175, between 396 and 402 is marker of 1945.

You can now replace the marker.text = "1900" line with what you want. You can make the box marker text a movieclip and it melted or slide in with the information you want.

If it helps, then remember to delete the xpos off stage text box and delete the line of script that uses it. It was just to test.

Here's the complete code

Tags: Adobe Animate

Similar Questions

  • Management change of HPSMH Collision detection

    Hello world

    We want to just implement collision detection mechanism in the management of change HPSMH. That means that if a CR was raised with a service assigned within a specific date range (say from 2nd to 4th month) .then if any new CR is triggered with the same affected service in the same amount of time then it will show a validation that the services concerned has already been used in a few other CR in the same amount of time.

    Hello and welcome to the HP support community!

    You have posted this question in the section the Community Forum of HP Android tablets.

    According to me, that's not the right area for your question.

    Myself, I have absolutely no idea what you're talking about!   :/

    WyreNut

  • In ActionScript 2 simple Collision detection?

    I'm doing a simple maze game, but the collision detection doesn't work. I have the player moving with the arrow keys, and I'm doing so that when the player collides with the wall, it goes to a certain range. I have this code in the wall clip:

    onClipEvent (enterFrame) {}

    If (_root.player.hitTest (this))

    {

    gotoAndStop ("death");

    }

    }

    Name of the instance of the player's 'player' and the wall instance name is "walls1". When the player hits the wall, the player goes right through it. I'm sure it's something with the collision, not the 'gotoAndStop ("death")"; because I've tested it with "gotoAndStop (5);" and the player is still through the wall.

    If someone could help me, I would really appreciate it. Thanks in advance!

    What object expect you goto frame 5 ("death")?

    You should move your code to the main timeline and target objects.

  • Collision detection changes the location of the MovieClip at random?

    Hello

    I was woundering how I had to code a program in AS3 on collision detection, it would change one of the objects collide at a random X & Y location?

    something like that, but works...?

    ship.addEventListener (Event.ENTER_FRAME, enter_frame);

    function enter_frame(event:Event):void {}

    {if (Ship.hitTestObject (target)}

    Target._x = random (1000)

    Target._y = random (1000) ;}

    }

    Found how do, but it does not work

    It is an AS2 implementation using the random method in your event handler function.  For AS3, use the Math.Random () as a multiplier and the properties of AS3 position (x / y, not _x/FLF).

    ship.addEventListener (Event.ENTER_FRAME, enter_frame);

    function enter_frame(event:Event):void {}

    {if (Ship.hitTestObject (target)}

    Target.x = Math.random () * 1000;

    Target.y = Math.random () * 1000;

    }

    }

  • Table element collision detection

    Hello!

    This is part of my code:

    var boxArray:Array = [];
    //...
    function init():void {
        stage.addEventListener(Event.ENTER_FRAME, loop);
    }
    
    function loop(e:Event):void {
    //...
    
    if(boxArray.length == 0){
            var totalX:int=9;
            var totalY:int=8;
            var spacing:Number = 10;
            var box_mc:MovieClip;
    
            for(var i:int = 0; i < totalX; i++){
                for(var j:int = 0; j < totalY; j++){
                    box_mc = new Box();
                    boxArray[i] = box_mc;
                    box_mc.instanceName = "box"+i+j;
                    trace (box_mc.instanceName)
    
                    box_mc.x = 80 + i*(box_mc.width+spacing);
                    box_mc.y = 70 + j*(box_mc.height+spacing);
                    addChild(box_mc);
    
                    trace (boxArray.length)
                    //---------------------------------------------it works:)
                }
            }
        }
    //there i need to add collision detection for array elements with "ball". Ball is a movie clip on stage.
    //need something like that i think:
    
    function collision(){
            var target = one of array element:)
    
            if(boxArray[target].visible==true){
                if (boxArray[target].hitTestObject(ball)==true) {
                    ballSpeedY*=-1;
                    score=score+100;
                    trace ('Score= ' + score);
                    boxArray[target].visible=false;
    
                }
            }
        }
    
       collision();
    
    
    
    //...
    }//end loop
    

    If anyone can help me I will be grateful

    Greetings and sry for my English :)

    In your collisionDetector function you want to set up two loops as you did when you created them to be able to go through all.  If you were to store in a single dimension table, it would be a loop less to deal with.  If you want / can do depends on if you need to retain the knowledge where the boxes are compared to the i / j clues when it comes to the "/ / do something ' is part of the treatment.

    In order to store in a single dimension table just use the push() method of the array class instead of their assignment with the brackets [i] [j].

  • Collision detection - then click on next picture

    Hello
    I just took the collision detection works on my classes, but I was not able to get the movie to go to another frame on the collision. What's my problem - I can't use go to 'Film1' in the handle on me, Manager of collisionData. For some reason, it won't let me SO I tried to call another Manager to the statement, moviejump = true. It also did not work - pointers please? Thanks for any help!

    Just set a variable in your collision Manager (a global variable would be easier), which means a frame break. for example:

    on ' t handle me, collisionData
    frameJump = true
    end

    Then, during your exitFrame script, check if this variable has been set:

    on exitFrame me
    If frameJump then
    go to section 3
    end if
    end

    -Ben

  • collision detection: custom class and table

    so I do a shooter from top to bottom for the pleasure, but have been struggling as I am new to programming.

    I have

    var player: player = new Player();

    enemy var: Array = new Array();

    now I searched on the net, but that's what I tried to work with.

    public void checkCollisionWithShip(): void {}

    for (var e = Enemies.length - 1; e > = 0; e-) {}

    If (Enemies [e] .hitTestObject (player)) {}

    trace ([e] Enemies);

    Life = 1;

    updateUI();

    trace ("ship collision!");

    }

    }

    }

    However, whenever my (player) ship hits an enemy, nothing ever happens.

    looking forward to your answers.

    Thank you very much for your time.

    Unfortunately the code that you decide should be shown is not code that needs to be shown.  Which calls the function where the collision is detected?  I don't see anything for this.

  • Collision detection

    Hi, so I applied a few detections of collision on walls using a table. Now I'm stuck when he tries with a single clip (see code). I get an error of syntax of 1084.

    below is what I got so far:

    import flash.display.Stage;

    import flash.display.MovieClip;

    import flash.events.KeyboardEvent;

    import flash.utils.Timer;

    import flash.events.TimerEvent;

    Variables

    var player: Player = MovieClip;

    var pDir:String = new String();

    var pStepSize:int = 5;

    var wallArray:Array = new Array (wall1, wall2, wall3, wall4, wall5, sidewall1, sidewall2, sidewall3, sidewall4);

    var purse: MovieClip = hands;

    var gameTimer:Timer = new Timer (0);

    Identical to gameTimer but then using an ENTER_FRAME (a loop with your framerate speed);

    stage.addEventListener (Event.ENTER_FRAME, __ontick__);

    Init

    Player.Stop ();

    IRDP = "NONE";

    gameTimer.delay = 25

    gameTimer.repeatCount = 0;

    gameTimer.start ();

    Events

    stage.addEventListener (KeyboardEvent.KEY_DOWN, keyPressedDown);

    stage.addEventListener (KeyboardEvent.KEY_UP, keyPressedUp);

    gameTimer.addEventListener (TimerEvent.TIMER, __ontick__);

    Functions

    function onTick(e:TimerEvent):void

    {

    movePlayer();

    rotatePlayer();

    collisionDetectPlayer();

    }

    function __ontick__ when using an ENTER_FRAME event

    /*

    function onTick(e:Event) {}

    movePlayer();

    rotatePlayer();

    collisionDetectPlayer();

    }

    */

    function keyPressedDown(e:KeyboardEvent) {}

    var: key: uint = e.keyCode;

    if(Key == Keyboard.Left) {}

    IRDP = 'LEFT ';

    Player.Play ();

    }

    if(Key == Keyboard.Right) {}

    IRDP = 'RIGHT ';

    Player.Play ();

    }

    if(Key == Keyboard.up) {}

    IRDP = "UP";

    Player.Play ();

    }

    if(Key == Keyboard.Down) {}

    IRDP = "DOWN".

    Player.Play ();

    }

    }

    function keyPressedUp(e:KeyboardEvent) {}

    var: key: uint = e.keyCode;

    If (key == Keyboard.LEFT |)

    key == Keyboard.RIGHT |

    key == Keyboard.UP |

    key == Keyboard.DOWN) {}

    IRDP = "NONE";

    Player.Stop ();

    }

    }

    function movePlayer() {}

    If (IRDP == 'LEFT') {}

    Player.x = pStepSize;

    }

    If (IRDP == 'RIGHT') {}

    Player.x += pStepSize;

    }

    If (IRDP == 'UP') {}

    Player.y = pStepSize;

    }

    If (IRDP == 'DOWN') {}

    Player.y += pStepSize;

    }

    }

    function rotatePlayer() {}

    If (IRDP == 'LEFT') {}

    Player.rotation = - 180;

    }

    If (IRDP == 'RIGHT') {}

    Player.rotation = 0;

    }

    If (IRDP == 'UP') {}

    Player.Rotation = - 90;

    }

    If (IRDP == 'DOWN') {}

    Player.rotation = - 270;

    }

    }

    function movePlayerBack() {}

    If (IRDP == 'LEFT') {}

    Player.x += pStepSize;

    }

    If (IRDP == 'RIGHT') {}

    Player.x = pStepSize;

    }

    If (IRDP == 'UP') {}

    Player.y += pStepSize;

    }

    If (IRDP == 'DOWN') {}

    Player.y = pStepSize;

    }

    }

    function collisionDetectPlayer() {}

    for (var i: uint = 0; i < wallArray.length; i ++) {}

    var wallTemp:MovieClip = wallArray [i];

    {if (Player.hitTestObject (wallTemp))}

    movePlayerBack();

    }

    }

    function collisionDetectMoneybag() {}

    If (player.hitTestObject (moneyBag) == true) {}

    If (dir == 'LEFT') {}

    Move the drive

    Player.x += 1;

    }

    If (dir == 'RIGHT') {}

    Player.x-= 1;

    }

    If (dir == 'UP') {}

    Player.y += 1;

    }

    If (dir == 'DOWN') {}

    Player.y-= 1;

    }

    }

    }

    What Miss me? Help is very appreciated!
    Matt

    If you read the error message is indicating a syntax error... He said that a final brace is missing.

  • Collision detection problem

    Hey guys,.

    I practice so the creation of a platform game. I have a movement system works, but when you try to add collision with platforms I have a problem.

    I did add each platform in a table and then check for the collision between the player and each platform, since I have just a bunch of instances without the platform symbol name on my stage. The problem with this is that my jumping code, I use a Boolean "onGround" value, which determines whether or not the player is "on the ground". And since my loop "foreach" across ALL platforms, even if the player is on a platform of some, there are other, it won't, and if it returns the onGround Boolean false.

    It's a problem with my code of jumping in general, I wonder where I get out of here. If I need to change my code from jumping, or change the collision, or what. Any ideas would be great. Here is my code:

    package  
    {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.KeyboardEvent;
        import flash.display.DisplayObject;
    
        public class Main extends MovieClip
        {
    
            var arrowUp:Boolean = false;
            var arrowDown:Boolean = false;
            var arrowLeft:Boolean = false;
            var arrowRight:Boolean = false;
    
            var arrowUpReleased:Boolean = true;
            var arrowDownReleased:Boolean = true;
            var arrowLeftReleased:Boolean = true;
            var arrowRightReleased:Boolean = true;
    
            var onGround:Boolean = undefined;
            var isJumping:Boolean = undefined;
    
            var vx:Number = 0;
            var vy:Number = 0;
            var acceleration:Number = 1;
            var gravity:Number = 0.3;
            var jumpForce:Number = 7;
    
            var speedLimit:uint = 6;
    
            var platformArray:Array = new Array();
            var platformNumber:uint = 0;
    
            var thePlatform:MovieClip;
    
            public function Main() 
            {
                stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
                stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
                stage.addEventListener(Event.ENTER_FRAME, update);
    
                for (var i:uint = 0; i < numChildren; i++)
                     {
                         if(getChildAt(i) is Platform)
                         {
                             platformArray.push(getChildAt(i));
                         }
                     }
                for each (var platform:DisplayObject in platformArray)
                {
                    if (platform.hitTestPoint(player.x, player.y + 20, true))
                        {
                            vy = 0;
                            onGround = true;
                        }
                }
            }
    
            function keyPressed(event:KeyboardEvent):void
            {
                if (event.keyCode == 37)
                {
                    arrowLeft = true;
                    arrowLeftReleased = false;
                }
                if (event.keyCode == 38)
                {
                    arrowUp = true;
                    arrowUpReleased = false;
                    isJumping = true;
                }
                if (event.keyCode == 39)
                {
                    arrowRight = true;
                    arrowRightReleased = false;
                }
                if (event.keyCode == 40)
                {
                    arrowDown = true;
                    arrowDownReleased = false;
                }
    
            }
    
            function keyReleased(event:KeyboardEvent):void
            {
                if (event.keyCode == 37)
                {
                    arrowLeft = false;
                    arrowLeftReleased = true;
                }
                if (event.keyCode == 38)
                {
                    arrowUp = false;
                    arrowUpReleased = true;
                    isJumping = false;
                }
                if (event.keyCode == 39)
                {
                    arrowRight = false;
                    arrowRightReleased = true;
                }
                if (event.keyCode == 40)
                {
                    arrowDown = false;
                    arrowDownReleased = true;
                }
    
            }
    
            function update (event:Event):void
            {
    
                //ACCELERATION
                if (arrowLeft)
                {
                    if (vx > 0)
                    {
                        vx = 0;
                    }
                    if ((Math.abs(vx)) < speedLimit)
                    {
                        vx -= acceleration/2;
                        player.x += vx;
                    }
                    else
                    {
                        player.x += vx;
                    }
                }
                if (arrowRight)
                {
                    if (vx < 0)
                    {
                        vx = 0;
                    }
                    if (vx < speedLimit)
                    {
                        vx += acceleration/2;
                        player.x += vx;
                    }
                    else
                    {
                        player.x += vx;
                    }
                }
                if (arrowUp && onGround)
                {
                    vy = -jumpForce;
                }
    
                //DECELERATION
                if (arrowLeftReleased)
                {
                    if (vx < 0)
                    {
                        vx += acceleration;
                        player.x += vx;
                    }
                }
                if (arrowRightReleased)
                {
                    if (vx > 0)
                    {
                        vx -= acceleration;
                        player.x += vx;
                    }
                }
    
    
                //GRAVITY
    
                player.y += vy;
    
                if (!onGround)
                {
                    vy += gravity;
                }
                if (onGround && !isJumping)
                {
                    vy = 0;
                }
                if (vy > 0)
                {
                    onGround = false;
                }
                else
                {
                    onGround = true;
                }
    
                //COLLISION
    
                for each (var platform:MovieClip in platformArray)
                {
                    if (platform.hitTestPoint(player.x, player.y + 20, true))
                    {
                        vy = 0;
                        onGround = true;
                    }
                    else
                    {
                        onGround = false;
                    }
                }
    
                trace (onGround);
            }
    
        }
    
    }
    

    Thank you

    PS what is happening right now with that code is that the player hit the platform and stops, but onGround rest false

    Probably, there is too much code for anyone to really go. However, from what you said on your loop for:

    for each {(var plate-forme: DisplayObject dans platformArray)}

    If (platform.hitTestPoint (player.x, player.y + 20, true)) {}

    Vy = 0;

    onGround = true;

    }

    }

    I think what you want is to put a break; in there right after onGround = true; -C' is to say stop the treatment when you find a ground plan.

    Also, there are a couple of collision of good systems out there that might make this a little easier and more robust. Take a look at the Kit of detection of Collision (CDK):

    https://code.Google.com/p/collisiondetectionkit/

  • Attribute points to the quiz slides using Pools of issue Manager

    Is it possible to assign the points must be reported to a slide when you use Pools of issue Manager?

    If a slide, for example, has 10 points, and another slide is 5 points, when they are both added to a question pool, make loose them their initial number of points and get assigned some number of points chosen when a random slide is added to the pool?

    I hope someone can clarify. Thank you.

    I just checked in Captivate 5 and it seems that the notation is associated to the Question pool, not inserted at random Question slide slide.

    If you are trying to achieve a result where the difficulty of the question has equaled the number of points awarded for doing things, you may need to put in place a number of question pools.  For example a pool of easy questions, another of medium difficulty and a third for really difficult.  Assign points 1 or 2 by default to the easiest, perhaps 5 for medium and 10 points for the hardest.

    That's what I do in fact.

  • the interference of tiles collision detection

    Hi, I have a bunch of tiles, I try to use as walls for the avatar (maze in place) and I encountered a problem with the detection of collision between two bricks and an avatar, as well as several instances of the same brick. Code attached.

    the_wall is a string. to help the flash to convert this string into a table to use object notation:

  • Corsair 3.0 slider 16 GB detected in BIOS but not in Windows 7...

    The usb works on all the other computers I tested, but not on mine. I have windows 7 Enterprise x 86 installed. In addition, it is detected in BIOS but not in windows... All solutions? Thank you.

    Hello KhurramHaider.

    I suggest that you go on the site crosair and look of the driver, if you found and installed and it STILL does not work, then there could be a problem in the operating system
    Concerning
  • Placement test / collision detection and HAVE

    Hello
    I am trying to find a way to perform a hit test on an object on the stage. The object makes its appearance through actionscript (block)
    and the object that it is player.
    This will work once I put the block on the scene not manually and not through actionscript, but I want the code allows to call the block because I called several blocks.
    See attached code...
    Could someone please tell me what I'm doing wrong?
    is it not possible that way?

    Thank you!

    Dear adamlewen
    If you want to remove each hittest movieclip, you must do it in a loop "for". so you can detect the hit test and make the corresponding visual effect.
    Here is a sample file: take a peek...
    you have some problem with naming movieclips that I think...
    you duplicated in your table, the elements that cause conflicts

    http://www.parspake.com/Majid/Flash/adamlewen.fla

    good luck and feel free to contact me if you have another problem
    concerning
    MajiD

  • SFC detects issues that he can't fix.

    Hello.

    I have recently run sfc/scannow and found reports 8 corrupted files that it cannot repair.

    After hours of research I keep coming with a lot of this is caused by one of the updates from Microsoft (KB3022345) and previous versions of the present.

    Apparently, Microsoft confirmed that the correction (KB3022345) breaks SFC/scannow.

    http://www.InfoWorld.com/article/2926179/Microsoft-Windows/Microsoft-confirms-patch-KB-3022345-breaks-SFC-SCANNOW.html

    How can fix us the corrupted files that are reported in the CFS?

    Microsoft is going to fix it with an update that resolves this problem and sfc?

    This seems to be a very miss leading the question a lot of people not knowing and or understanding is restoring and or completely reload their operating systems in this.

    While others try to fix it by uninstalling this update has also led to further complications and or errors.

    Don't want to restore or reload my system operating either in the course of this (corrupt files / can't fix the problem) but I'd like to see sfc scan of own health again.

    Please explain.

    Thank you very much.

    Frank.

    KB3022345 was later replaced by KB3068708, which also violates SFC.  Suggest you remove it.

  • HitTestObject collision detection works not... ish

    Of course, as you can see in this clip of the Hit and Miss is not corresponding to the real event on the stage. Why? It only works if I give the name of the instance of the objects, but does not when you use the name of var. Why?

    Here is the code:

    import flash.events.Event;

    gball var: SmallGreenBall1_T = new SmallGreenBall1_T();

    var bucket: allBuckets = new allBuckets();

    this.addEventListener (Event.ENTER_FRAME, handleCollision)

    function handleCollision(evt: Event): void {}

    If (gball.hitTestObject (bucket)) {}

    output_txt. Text = "HIT."

    } else {}

    output_txt. Text = "MISS."

    }

    }

    Maybe you just need to remove the code.  If you have a gball onstage and a bucket on the stage, use:

    import flash.events.Event;

    this.addEventListener (Event.ENTER_FRAME, handleCollision)

    function handleCollision(evt: Event): void {}

    If (gball.hitTestObject (bucket)) {}

    output_txt. Text = "HIT."

    } else {}

    output_txt. Text = "MISS."

    }

    }

    p.s. If this fails, is interpolated gball schedule?

Maybe you are looking for

  • Using the camera!

    All too complex for geriatric brain!  I want to transfer photos from camera to the IPad.  Wi - fi, they can "see" each other, but it doesn't seem to be of any medium to copy the photos on the iPad. Is this possible? Y at - it app for download or some

  • Skype problems by games

    I reinstalled my system and since then I can't Skype and launch a game at the same time as the others however, but I heard that they do not have when I say something. What can you do about it, internet service, but it is enough it simply doesn't. Wha

  • Snooze configurable time &amp; editting custom alarms

    like the dashboard, but there are a number of oddities of alarm boring. First is the rehearsal time. It is located at 5 minutes. It's really short. Is it possible to allow configurable snooze time? SNOOZE is usually 10 minutes... How to set the time

  • In the edition browser - added the Sections

    I have a news page on my site and I would like to know if my client would be able to add a new article by themselves by using the editing in the browser.I understand that they can do minor change but y at - it a way to copy a slice and paste slot (fo

  • Need CMYK for printer... but the msg «document uses space mix CMYK...» "concerning

    Hi allI need to create PDF output which is the printer CMYK.I thought I did everything correctly until I got this message that was generated when I chose to export (in PDF format), "the document uses space CMYK. Are converted to RGB in interactive PD