# Just a push in the right direction please?!

**URL:** https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844
**Category:** flash
**Created:** [November 29, 2002, 4:21pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844 "2002-11-29T16:21:28Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![yorkshirepuddin](https://avatars.discourse-cdn.com/v4/letter/y/aeb1de/32.png) [@yorkshirepuddin](https://forum.kirupa.com/u/yorkshirepuddin)
#### Post date: [November 29, 2002, 4:21pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/1 "2002-11-29T16:21:28Z")

</div>

Okay, I’m not looking for the code (I want to try and figure it out), just a point in the right direction.

Here’s what I need to do.

On my navigation, I have 3 options. On first click on any of these, I need to place an animation only once and never again.

Obviously, I need to establish some script stating if it the first click then perform ‘this’ but not if the second click.

However, it has to work a little differently. It shouldn’t be first click on each button, but first click on any button.

What is will do is load the content (some fancy animation), but obviously I don’t want to load it each time as it’s all in the same MC so is unnecessary.

I’m guessing I maybe need to set up ‘if/else’ statements or perhaps 'array’s or ‘both’?

Hints anyone? Remember, no giving it away or I’ll never learn.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 4:47pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/2 "2002-11-29T16:47:50Z")

</div>

I’m not sure I totally understand what you’re trying to do…

So, you want an animation to play only once when you click a button. However, no matter **which** of the three buttons you click, you want it to play they play no more?

Just making sure before I point you in a "point"less direction! (hyuk…hyuk… sorry).

And sometimes you can learn from getting all the code at once, as long as it’s explained to you 🙂

Well, let me know.

- wobbly

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 4:55pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/3 "2002-11-29T16:55:44Z")

</div>

Let me explain better.

On inital load of my site, no content will be present. So, when the user selects one of the nav options, I want to play a ‘little’ animation that will eventually reveal the content. But, this only needs to play once, not every time the user selects a nav option.

So, I need to tell my movie, that if this is the first time a nav component as been selected, play this animation. However, if they have already selected a nav option, and then pick another, I don’t want the animation to play. Does that make sense?

You’re right, getting the code can be just as useful, feel free to give it to me if you have it. 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 5:16pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/4 "2002-11-29T17:16:12Z")

</div>

I’m getting in the shower right now (like you needed to know that), but real quick before I go:

Try making all the nav buttons an instance of the same symbol. The symbol has the AS to make the movie play only once, while each instance can contain the AS to do their navigation duties.

Just a shot, I am pretty new to AS 🙂

Well anyways, let me know how things go. I’ll help more later if need be.

- wobbly

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 7:34pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/5 "2002-11-29T19:34:25Z")

</div>

Wobbly, not sure what you mean. Right now, all the nav is contained and controlled from an MC. Can I still do it that way?

What is I have 2 instances of the Nav, and on first click switch other version. Oh, I think I have an idea now! ;0)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 7:44pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/6 "2002-11-29T19:44:54Z")

</div>

York, If I understand you correctly, what you need is an action that performs only once then disables itself. David helped me with a similar problem awhile back in another thread. Here’s the link to that thread, it might come in handy. =)

[http://www.kirupaforum.com/showthread.php?s=&threadid=8881](http://www.kirupaforum.com/showthread.php?s=&threadid=8881)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 8:19pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/7 "2002-11-29T20:19:59Z")

</div>

This kind of helps. I think I need to adjust the script a little to say:

If this MC(loadcontent) has played, then do this, if not go to MC and play.

I have labels set up in the target MC for loadconent and contentloaded.

So, to make it clearer, I guess I need to say:

if ‘loadcontent’ is at ‘contentloaded’ go and do this  
if ‘loadcotent’ isn’t, then go to and play ‘load content’.

I just need to figure that part out! 😏

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 8:33pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/8 "2002-11-29T20:33:36Z")

</div>

Yah, I wrote my first if/else statement all by myself! :beam:

So, I’m _almost_ there with this. Here’s the code:

cranium.onPress = function() {  
with (\_root.loadcontent) {  
if (\_currentframe == 40) {  
loadMovie(“content.swf”, \_root.contentarea);  
\_root.targetx = -280;  
\_root.slide.gotoAndPlay(“move”);  
} else {  
with (\_root.loadcontent) {  
gotoAndPlay(“loadcontent”);  
}  
}  
}  
};

I just now need to tell it to load content at the end of loadcontent …

Thanks guys, lovingly yours, the if/else statement queen!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 8:50pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/9 "2002-11-29T20:50:39Z")

</div>

Okay, so now I am stuck a little on the next part.

How do I tell the whatever to go here dependant on which button is pressed? mmm … ponder ponder …

Hope someone can help, in the meantime I’ll just hope the light bulb turns on!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 8:52pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/10 "2002-11-29T20:52:24Z")

</div>

Hold that thought, the bulb turned on sooner than I thought. I’ll get back if my idea is just wind!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 8:58pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/11 "2002-11-29T20:58:54Z")

</div>

It wasn’t! Yah, no more help needed.

Here’s the script I had to write (yeah, I wrote all by myself :beam: ) to get the ‘loadcontent’ movie to detect which button had been pressed:

if (\_root.navigation.cranium.onPress) {  
loadMovie(“content.swf”, \_root.contentarea);  
\_root.targetx = -280;  
\_root.slide.gotoAndPlay(“move”);  
}

Works like a charm!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 9:12pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/12 "2002-11-29T21:12:04Z")

</div>

I envy you York, I can’t read or write actionscripts. When it comes to actionscripting, I feel like a blind asian guy trying to read Hebrew. :-\

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 9:21pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/13 "2002-11-29T21:21:42Z")

</div>

> \*Originally posted by electrongeek \*  
> \*\*I envy you York, I can’t read or write actionscripts. When it comes to actionscripting, I feel like a blind asian guy trying to read Hebrew. :-\ \*\*

Hey, I was the same! Time and patience my friend! 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 9:44pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/14 "2002-11-29T21:44:34Z")

</div>

Actually, I have a wee clitch!

First off here’s the AS on the actions layer of my nav:

cranium.onPress = function() {  
with (\_root.loadcontent) {  
if (\_currentframe == loadcontent) {  
\_root.targetx = -280;  
\_root.slide.gotoAndPlay(“move”);  
} else {  
with (\_root.loadcontent) {  
gotoAndPlay(“firstload”);  
}  
}  
}  
};

Here’s the clitch.

Now, everytime I press this particular button, it will play the animation (firstload) rather than just progressing and doing the part in the ‘if’ section. What did I do wrong?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 9:47pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/15 "2002-11-29T21:47:01Z")

</div>

Oh wait, I think I know what I have to do:

Instead of:

if (\_currentframe == loadcontent) {  
\_root.targetx = -280;  
\_root.slide.gotoAndPlay(“move”);

I should instead do if ‘this swf’ is loaded, that do the \_root thing.

Obvioulsy, if it’s not loaded, that it would have to play the animation.

Okay, now I need to learn how to detect is something is loaded in.

Hope I’m not confusing you all.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 10:04pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/16 "2002-11-29T22:04:27Z")

</div>

York you lost me a long time ago, I’m still trying to analyze your code, but I’m waiting patiently for the answer to your problem.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 10:23pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/17 "2002-11-29T22:23:30Z")

</div>

Yeah I know, I think I’m just having a conversation with myself in this thread! :crazy:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 29, 2002, 10:43pm UTC](https://forum.kirupa.com/t/just-a-push-in-the-right-direction-please/8844/18 "2002-11-29T22:43:54Z")

</div>

Okay, now i am stumped. Can anyone help? Let me know if I need to explain things … it got a little messy back there!
