• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Code Snippets are in the Timeline, but Fail to Work

New Here ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

I'm fairly new to Flash Professional and Actionscript; thus, forgive me if I sound ignorant on certain things.

I'm trying to create a simple movie file in Flash, and I wanted to do transitions between certain pictures. I found out code snippets are a thing, and I did everything I was told to in the Lynda.com tutorial (as I'm using that to teach me what to do). I clicked on my image, went to the Code Snippets bar, put in "Horizontal Transition," and it showed up in my timeline. Even so, the code snippet did nothing. I had the picture activated so it knew to move that particular picture, I had the instance name in the code so it knew which file I wanted to move, I had the default 100 for how many pixels I wanted to move it...I did everything it told me to, and yet the image still stays in the same place. What am I doing wrong?

TOPICS
ActionScript

Views

412

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

Show the code you are using and indicate which object in that code is failing to perform as expected.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

Alright; here they are.

screen1.PNG

I wanted to take this picture and move it horizontally (highlighted in the code snippets bar), so it would expose the right half of the picture and slowly expose the left half.

screen2.PNG

I even made it a movie clip and added an instance name so I'm able to attach the code.

screen3.PNG

So I have this, and the code automatically attaches the code for the object to Actions. Maybe this is the problem and I'm overlooking it? Now that I think about it, possibly. Anyway, I've clicked on the item, made it so it would move over to the right by 100 pixels. Same name, no typos, everything is perfect.

Even so, I click play to test it out, and it refuses to work. The picture just stays in place.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 05, 2015 Oct 05, 2015

Copy link to clipboard

Copied

The way that you have attached that code to the timeline will cause that code to execute as soon as the movie begins to run. That means that the object named "shesleep" will move right at the start and so you won't see the action. If the object is showing in the default location when the movie runs then there is likely something else going wrong. Do you get an error when you test this movie?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 05, 2015 Oct 05, 2015

Copy link to clipboard

Copied

No, I don't get an error...though that is interesting, how you mentioned that it would move straight from the start. I played around with it for a bit and found out how to move the image with the code snippet (hallelujah), but when the code snippet activates, the image moves very choppily. Would I have to use a motion tween to have it smoothly move from the right side of the image to the left, or...?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 05, 2015 Oct 05, 2015

Copy link to clipboard

Copied

apply the "Animate Horizontally" Function, not Move Horizontally..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 05, 2015 Oct 05, 2015

Copy link to clipboard

Copied

As you can use some animation library like Greensock

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 06, 2015 Oct 06, 2015

Copy link to clipboard

Copied

LATEST

Yes, the code as you have it now will make your object move in one step. If you want that motion to be more smooth, you can break it up into a number of smaller steps. You could use the "animate horizontally" snippet as nezarov suggests. That animation action is contained in a repeating function and so the movement will continue forever, even after the object has moved off the visible area of the stage. Tweening is a method of adding timing changes to an animation. Tweening can give you the illusion of acceleration  or deceleration, for instance. If you are using Actionscript for the tweening, you will need to give the object a starting point, and ending point and a number of iterations for the tween. If you tween using keyframes and the timeline the operation is somewhat different. Here's a Flash help file that explains the basics: Flash Professional Help | Animation basics

Below are three other help files that can give you more information on using code snippets:

Code snippets for beginning ActionScript 3 programmers and designers | Adobe Developer Connection

Flash Professional Help | Add interactivity with code snippets

http://code.tutsplus.com/tutorials/quick-tip-exploring-the-flash-cs5-code-snippets-panel--active-490...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines