Timer does not move movieclip

Hello I have set up a timer to try and get char_mc to move when I take a touch because I am an ios app. I have this code

import flash.events. *;

import flash.utils.Timer;

import flash.display.MovieClip;

import flash.events.MouseEvent;

var movetimer:Timer = new Timer (50);

leftarrow.addEventListener (MouseEvent.MOUSE_DOWN, leftarrowfunctionDown);

leftarrow.addEventListener (MouseEvent.MOUSE_UP, leftarrowfunctionUp);

rightarrow.addEventListener (MouseEvent.MOUSE_DOWN, rightarrowfunctionDown);

rightarrow.addEventListener (MouseEvent.MOUSE_UP, rightarrowfunctionUp);

movetimer.addEventListener (TimerEvent.TIMER, leftarrowfunction);

movetimer.addEventListener (TimerEvent.TIMER, rightarrowfunction);

function leftarrowfunctionUp(e:MouseEvent):void

{

movetimer. Stop();

}

function rightarrowfunctionUp(e:MouseEvent):void

{

movetimer. Stop();

}

function leftarrowfunctionDown(e:MouseEvent):void

{

movetimer. Start();

}

function rightarrowfunctionDown(e:MouseEvent):void

{

movetimer. Start();

}

function leftarrowfunction(eventObject:Event):void

{

char_mc.x-= 1

}

function rightarrowfunction(eventObject:Event):void

{

char_mc.x += 1

}

This should move my character a pixel every 50ms while im holding the buttons on the right or the left, but the character doesn't move at all. There are no errors. Any ideas? This code is on my layer actions.

You have ooposing two functions to work then bind you don't not to move.  The timer call both the law and the functions of the arrow to the left to the object would be moving just a pixel and a pixel to the left, the net effect by going nowhere.

Just a function to the timer which checks if the right or the left button is in use (or not) and have this conditional dictate which way to go.  Have the functionality of the button, the value of a Boolean variable that indicates whether or not they are used... use this variable in your conditional timer.

var goRight:Boolean = false;

var goLeft:Boolean = false;

function leftarrowfunctionUp(e:MouseEvent):void

{

goLeft = false;

}

function rightarrowfunctionUp(e:MouseEvent):void

{

goRight = false;

}

function leftarrowfunctionDown(e:MouseEvent):void

{

goLeft = true;

}

function rightarrowfunctionDown(e:MouseEvent):void

{

goRight = true;

}

function timerfunction(eventObject:Event):void

{

If (goLeft) char_mc.x-= 1;

If (goRight) char_mc.x += 1;

}

Tags: Adobe Animate

Similar Questions

  • FCPX - marker of time does not move during playback

    All the world has noticed this annoying bug? During playback of content video plays normally in the preview window, but the marker of time in the timeline panel locks into place and not moving from left to right in real time. When I stop reading, then the marker jumps to the position in the timeline, it is supposed to be. Makes it much more difficult to change. I checked my preferences and couldn't find anything that would cause this erratic behavior. Any input will be appreciated. Thank you.

    TTry trashing prefs and reboot. Is there a lot of graphics and unreturned equipment in the timeline?

  • Mute icon in the center of the screen does not move and does not remove

    Mute icon in centerl of the screen does not move and I can't remove it. It does not seam to meet what I did.

    Try below before he came.

    Restore point:

    http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/

    Do Safe Mode system restore, if it is impossible to do in Normal Mode.

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    http://www.windowsvistauserguide.com/system_restore.htm

    Read the above for a very good graph shows how backward more than 5 days in the System Restore Points by checking the correct box.

    See you soon.

    Mick Murphy - Microsoft partner

  • CTI does not move on TimeLline reading durning

    CTI does not move on TimeLline reading durning

    After modification of video clips and then adding title, trasitions, ets - CTI (Curreent time Indicatot) will not move while video plays in the monitor.

    I went on the first Forum and found nothing on this subject.

    This looks like a potential problem to display GUI.

    I would go to to the mfgr of the video card. Website, download and install the latest version for your operating system and your brand/model card.

    If you have a HP or Dell, their Web site would be my first stop, because each tweaks drivers ATI/nVidia a little.

    Good luck

    Hunt

  • Fixed background (resize browser so background does not move)

    Hey,.

    Im a noob to dreamweaver please bear with me while I try to explain this to you guys.

    IM designing a website and I need to keep the background image in a fixed position, so that when you resize the Explorer it doesn't move and stays in the place you want according to the homepage. For example the adobe forums who we are, when you resize the window, the background does not move, but extends to the place, letting the checkerd design where it is next to the page, except that I need that on both sides. (For example, gametrailers.com, resizing, it leaves beside the page designs.

    I can't really explain much more of that, I just need the background image to remain fixed behind the page, and I have no idea how do, not to mention that the method or style is called so I can't search for tutorials. Sorry if I used termanoligy evil or anything, really new to this.

    Thank you

    Devresse

    (For example, gametrailers.com, resizing, it leaves beside the page designs.

    This site uses the following CSS rule on the body tag

    {body
    margin: 0;
    text-align: center;
    background: #C2C4C6 url(/images/gt6background.gif) scroll Center repeat-y;
    }

    If you are not familiar with CSS, now is a good time to start learning to decipher meanings.

    You can use 'fixed' instead of 'scroll '.

  • Playhead does not move - no error

    Hey guys, I don't really know how to describe this problem but I don't want to give it a try. I work in Flash cs3 using as3. I have a project with 5 scenes and nav button to jump between them. When I test the stage of draft 1-4 play fine however when I get to stage 5 playback head does not move, there's just parked on frame 1 (nav button works, animation does not). When I rearrange the stacking order of my scenes the same problem occurs in a different scene that had previously played fine. This problem only occurs when I test the movie - if I test any scene by himself, he plays very well. I don't get any errors AS that adds to the frustration. Any ideas or suggestions would be greatly appreciated.

    Tim

    There is a limit of 16000 images.  you have well over many frames?

  • Alarm and timer does not iOS 6 s 10

    Help! After having downloaded the iOS 10, my alarms and timer does not work. During the years that I have had 4 different alarms set - 2 in the morning and 2 the afternoon. This morning the alarm at the top of my phone icon was there, so I assumed that everything was settled as it is normally. I was wrong. My 05:30 alarm has not extinguished the next morning. The next day, I could turn it back on, but when I went to all other lights it shuts down another. It would only be standing. So, I opted for the alarm from 05:30 again. With my phone not allowing an alarm to be defined at the time, now I'm going to put it but it randomly turns off its own. I'm FED UP with it! I used my phone as alarm clock years but had to go out and by a real wake-up call to make sure I wake up in the morning. Not only that, but my timer does not work either. What is someone is having these problems?

    I did have the problem where one turn the other goes out, but since I got my iPhone with iOS 10 7 or my alarm not timers turn off. I watched the ticks to zero with no sound, no matter what I do. There is no problem with volume control and I did it with the key "secret" on and outside. I am at a total loss.

  • Tap to talk time does not work on my watch

    Hey guys!

    Tap to talk time does not work on my watch.

    I know that his works only with Mickey/minnie.

    the watch is after unpari/pair, the "tap to speek" function is enabled (on the iphone and the watch)

    both are updated to the latest ios/watch OS and still...

    any ideas...?

    Thank you!

    Return on investment

    Hi King

    I suggest to wait until a few hours, leaving the face of Mickey or Minnie Mouse selected on your watch.

    My own experience (tested on two watches) is that the feature became available after waiting, without rebooting or unpairing / rematching of the watch. In one case, it took somewhere 3-5 hours, but you can see that the function starts working sooner than that.

    It can help to first turn the tap to set the time to stop, pause for a few moments and then turn it back on again.

  • iTunes does not move files to the Recycle Bin

    Today I noticed that when I delete a song in iTunes and select the option "Move to trash", the file does not move in my trash and rest in the iTunes media folder. When I right click on a song in iTunes and select "Show in finder" and delete the song here I am prompted for my password for finder make changes... I suspect that this could be the problem. iTunes cannot go beyond the 'enter password to make changes in the finder' automatically? Help, please! It's pretty frustrating

    Thanks in advance

    RosBufo

    I'm not positive, but it sounds like a permissions issue. Back up your computer then:

    Read the part about changing the permissions on the folder iTunes: https://discussions.apple.com/message/11583914#11583914

    LincDavis June 2015 post on the whole correction of the permissions on the Directory user-

    https://discussions.Apple.com/message/28436841#28436841

  • EL Capitan automatic date time does not work

    People

    I use an El Capitan 10.11.5 MacBook Air version.

    I noticed that the data and time does not work even though it was set to auto to time.asia.apple.com.

    I ran these commands on a terminal

    $ping-c 5 time.asia.apple.com

    Ping: impossible to solve the time.asia.apple.com: Unknown host

    $ping-c 5 time.nist.gov

    PING ntp1.glb.nist.gov (64.113.32.5): 56 bytes

    64 bytes from 64.113.32.5: icmp_seq = 0 ttl = time 44 = 386,629 ms

    64 bytes from 64.113.32.5: icmp_seq = 1 ttl = time 44 = 307,532 ms

    tell me ping works but not for the server ntp - time.asia.apple.com

    $nslookup time.asia.apple.com

    Server: 192.168.1.254 address: 192.168.1.254 #53

    Non-authoritative answer: time.asia.apple.com canonical name = time - ios.g.aaplimg.com.

    time - ios.g.aaplimg.com canonical name = site time.apple.com.

    Site Time.Apple.com canonical name = time - osx.g.aaplimg.com

    $cat /etc/ntp.conf

    Server time.asia.apple.com.

    $ ntpq Pei

    No returned ID association

    Please, back up all data.

    Open the window of network preferences, if necessary, by clicking on the padlock icon in the lower left corner and entering your password. Cllck advanced, open the DNS tab and change the addresses of the servers as follows:

    8.8.8.8

    8.8.4.4

    It's Google DNS. Click OK, and then apply.

    In Safari, select

    ▹ Safari preferences... ▹ Confidentiality ▹ Remove All site data

    and confirm. If you use another browser, clear the cache memory. Test. Any difference?

    Notes:

    1. If you lose Internet access after the above change is made to your network settings, remove the Google servers in the network preferences pane, then click on the TCP/IP tab, then click on renew the DHCP lease. That should restore the original DNS settings; otherwise restore them yourself. Remember that you must click on apply so that the changes take effect.

    2. I do not use Google DNS myself, but I tested it, and I do not recommend it or any other provider DNS; the addresses of the servers are only available for testing purposes. There may be privacy and technical issues involved in the use of this service, that you should personally study before deciding whether to retain the settings. Other public DNS services exist.

  • Face time does not work since this morning if my wifi connection is fine and parameters also very well.

    IPhone 6, 114 GB, GB 72.6 available capacity. iOS 9.3.1

    Face time does not work since this morning. Connection Wi - Fi works very well

    Mamimisra wrote:

    IPhone 6, 114 GB, GB 72.6 available capacity. iOS 9.3.1

    Face time does not work since this morning. Connection Wi - Fi works very well

    https://support.Apple.com/en-us/HT204168

  • The date and time does not work.

    I have an iphone 5 c.

    The date and time does not work. This is the second time.  The first time was about 3 to 4 months again and now again after upgrade to iOs9.3.1.

    Even after trying to change it manually, time slows down or stops.

    Everyone has problems with their date and time?

    • Try a forced reboot: hold down the House and on the buttons until the unit turns off. Ignore the cursor off if it appears. Once completed, if it does not start on it own, turn off power with the key On. In some cases, it also contributes to double click the Home button and close all applications before restarting.
    • Restore factory settings (no backup)
    • Make an appointment at your local Apple store to have it checked.
  • Magic Mouse does not move the cursor

    After I pair my magic mouse, it scrolls and the buttons work, but the cursor does not move. What can I do to restore the mouse entirely, or even remove the name? Or what else should I do to solve the problems.

    What is the new Magic mouse (MM2) you have?

    And you're running with Yosemite, as shown in your profile.

  • The slider side does not move when I put the mouse on it, I need to click below or on the arrow down. Once he left the first place, it moves. Also some applications like changing the city the weather button won't change.

    The slider side does not move when I put the mouse on it, I need to click below or on the arrow down. Once he left the first place, it moves. Also some applications like changing the city the weather button won't change.

    The extension of the Yahoo! toolbar and the extension of Babylon have been reported to cause a problem like that. Disable or uninstall the modules.

       * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    
  • My ink carriage does not move to the way to replace the ink cartridges. I think I put the ink in the wrong office

    My ink carriage does not move to the way to replace the ink cartridges. I think I put ink in bad officejet 3830

    Hello! Welcome to the community @Tammy111 HP

    I read your post about the ink carriage being stuck in your Officejet 3830, and I wanted to respond to troubleshoot. Try these steps and if the transport is not yet move to order so that you can access the ink, then your best bet would be to call phone support to see if they can replace the unit for you. I'll leave their details below.

    HP OfficeJet 3830, DeskJet 3830, 5730 printers - an error 'Transport Jam'

    Click on the thumb to below testify my help!

    Click on the "accept as Solution" if I'm you guide to a solution!

    Contact HP:

    Step 1. Open the link: www.hp.com/contacthp/

    Step 2. Enter the product number or select Auto detection

    Step 3. Scroll up to "still need help? Fill out the form to select your contact options.

    Step 4. Scroll down and click on: contact HP options - click Get phone number

    File number and phone number appear

Maybe you are looking for

  • Air 2 > mini 4

    I have an iPad 2 air. If I buy a new mini 4, then I load it with the Air 2 on iTunes backup? Thank you.

  • Satellite C50 - A - 1 6 - need a HD Toshiba Driver webcam

    Satellite C50 - A - 1 6 8.1 64-bit windows. is the model I have, my webcam just needs a driver to work again. assistance please :/ or the official driver download link.could not find one on the toshiba site.Thanks in advance

  • Photosmart 6520: can't get 2 sides Preset to save

    I use this printer connected by USB to an iMac running OS 10.9.5,, but this isn't a new problem. I want to print my bank statements using this configuration: double-sided and odd pages only.  I can't get this save as preset. It seems that when I try

  • Iastor0 error in Event Viewer (computer freezes)

    Hello! I'm looking for advice on how to troubleshoot or correct an error in the event viewer. Error in Event Viewer shows Event ID 9 "the device, \device\ide\iaStor0, did not in time-out." I have Windows XP SP3 on a Dell Optiplex 755 image fitness an

  • OfficeJet 6000 software install problem

    Hi all I have messaged HP about this problem but I was wondering if someone here could help. I just bought an Officejet 6000 as the title. I have installed the software network no problem at all on 3 laptops running Vista, 1 PC under XP and 3 PC runn