Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE FLASH:HomeFlash ForumFlash TutorialsFlash Video TutorialsWeb Streaming ForumAdobe FlashPodcast

simple as3 codes

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Seth Jillsonsimple as3 codes
by on Aug 2, 2012 at 12:39:42 am

4481_grenadelevel.fla.zip

Can someone please download this file and help?

First off, don't hate. I'm new to as3 and i cant figure this simple code out. You need to click on the grenade in time before it blows up. Up to that point it works fine.

Where it goes wrong is you're supposed to hold down on the grenade and the meter goes up. If you release the grenade when the meter's in the middle color. When you hold down on the grenade, the meter doesn't go up. If someone could help me with these codes I would appreciate it.


Return to posts index
Reply   Like  

demetri tashieRe: simple as3 codes
by on Aug 2, 2012 at 4:45:38 pm

without looking at your file, i would say that this could be done a few ways. some ways are using either a TIMER Event or an ENTER_FRAME Event triggered by a MOUSE_DOWN to update a text field.

consider this scenario: a dynamic textfield ( your 'meter') with the instance name 'myText' has its value increased by a MOUSE_DOWN over a movieclip with instance name 'grenade'.

here is some full code which would make it work, using a TimerEvent:
import flash.events.MouseEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;

grenade.addEventListener(MouseEvent.MOUSE_DOWN, meterUP);
stage.addEventListener(MouseEvent.MOUSE_UP, meterSTOP);
grenade.addEventListener(MouseEvent.MOUSE_OUT, meterSTOP);

var tim:Timer = new Timer(500);

var grenNum:uint = 0;

function meterUP(e:MouseEvent):void {
tim.addEventListener(TimerEvent.TIMER, startTimer);
tim.start();
}

function meterSTOP(e:MouseEvent):void {
tim.stop();
tim.removeEventListener(TimerEvent.TIMER, startTimer);
}

function startTimer(e:TimerEvent):void {

grenNum=Number(myText.text);
myText.text = String(grenNum + 1);
}


there is a working example, as well as some further explanation, here: example

I hope that helps you work it out. if you have any further specific questions, please ask


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]