# Function not working

**URL:** <https://forum.kirupa.com/t/function-not-working/182934>\
**Category:** flash\
**Created:** [March 22, 2006, 3:59pm UTC](https://forum.kirupa.com/t/function-not-working/182934 "2006-03-22T15:59:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Catalist](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/catalist/32/2148_2.png) [@Catalist](https://forum.kirupa.com/u/Catalist)\
**Post date:** [March 22, 2006, 3:59pm UTC](https://forum.kirupa.com/t/function-not-working/182934/1 "2006-03-22T15:59:14Z")

</div>

I’m making a little quiz for school. And a function I used just the other day isn’t working. Why not.:q:

```auto

stop();
countries(c1,"Morocco",p1);
//more African countries.
function countries(box,count,countx){
     if(box==count){
          countx=1;
     }else{
      countx=0;
}

```

That’s all on frame 1.  
On frame one there’s also an imput text box with the instance name c1, and a next frame button.  
On the next frame I have a dynamic text box witht he instance name total.  
frame 2 has the AS

```auto

//imagine p1+p2+p3+p4
toatal.text=p1
}

```

Why dosen’t this work?

---

<div class="post-metadata">

**Author:** ![EmeniusXp](https://avatars.discourse-cdn.com/v4/letter/e/ad7895/32.png) [@EmeniusXp](https://forum.kirupa.com/u/EmeniusXp)\
**Post date:** [March 22, 2006, 4:09pm UTC](https://forum.kirupa.com/t/function-not-working/182934/2 "2006-03-22T16:09:14Z")

</div>

first of all, you posted this like 5 times

second, you are calling a function before it’s defined

---

<div class="post-metadata">

**Author:** ![sed\_thh](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@sed\_thh](https://forum.kirupa.com/u/sed_thh)\
**Post date:** [March 22, 2006, 4:11pm UTC](https://forum.kirupa.com/t/function-not-working/182934/3 "2006-03-22T16:11:38Z")

</div>

you can call functions before they are defined, but in flash 8 you must define the type of variables like:  
function you\_have\_posted\_it\_5\_times\_noob(ban:boolean){  
if (!ban) ban=true;  
}

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 22, 2006, 4:12pm UTC](https://forum.kirupa.com/t/function-not-working/182934/4 "2006-03-22T16:12:19Z")

</div>

lol nice

to that i say:

```auto
onEnterForums = function() {
   if (it_happens_again){
      you_have_posted_it_5_times_noob(1);
   }
};

```

---

<div class="post-metadata">

**Author:** ![Catalist](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/catalist/32/2148_2.png) [@Catalist](https://forum.kirupa.com/u/Catalist)\
**Post date:** [March 22, 2006, 10:41pm UTC](https://forum.kirupa.com/t/function-not-working/182934/5 "2006-03-22T22:41:50Z")

</div>

```auto

onEnterThisThread=function(){
     if (Catalist=shammed){
            Catalist=null;
     }
}

```

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [March 23, 2006, 6:11am UTC](https://forum.kirupa.com/t/function-not-working/182934/6 "2006-03-23T06:11:22Z")

</div>

> [@sed|thh](#):
>
> you can call functions before they are defined

Only if they are defined as _function myFunction(){}_ and not as _myObj.myFunction = function(){}_

> [@sed|thh](#):
>
> but in flash 8 you must define the type of variables

No you don’t 🙂

---

<div class="post-metadata">

**Author:** ![gvozden](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gvozden/32/1084_2.png) [@gvozden](https://forum.kirupa.com/u/gvozden)\
**Post date:** [March 23, 2006, 6:25am UTC](https://forum.kirupa.com/t/function-not-working/182934/7 "2006-03-23T06:25:20Z")

</div>

canadian 👼

---

<div class="post-metadata">

**Author:** ![sed\_thh](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@sed\_thh](https://forum.kirupa.com/u/sed_thh)\
**Post date:** [March 23, 2006, 8:26am UTC](https://forum.kirupa.com/t/function-not-working/182934/8 "2006-03-23T08:26:53Z")

</div>

m’kay :huh:
