ActionScript 2.0 :: Make A Sound When Pick It Up?
Feb 3, 2012I am making a platformer game, and I have money I pickup. How do I have the money make a sound when I pick it up? I am using flash 8
View 1 RepliesI am making a platformer game, and I have money I pickup. How do I have the money make a sound when I pick it up? I am using flash 8
View 1 RepliesI've spent the last few days trying to find an answer to this seemingly simple question, and no luck. Well, partial luck, but not quite what I wanted.
My problem is this - I want to play a random sound when an event happens. In AS2, I used to do this[code]...
sorting out the lowest times (tid) and put them at the top of my scoreboard. All my scores are saved in a XML document and this is the code in the AS that puts the text into a textfield called "content_text".
[Code]...
I have several buttons in a movie and I want to be able to rollover an individual button and play the sound for that button and when I rolloff I want the sound for that button to stop.
View 6 RepliesI use Flash MX 6.0
1) I have a button and when I put cursor over it, it must start looping a sound. When I drag away, the sound must stop. I would be even cooler if it was possible to make the sound fade away when the mouse is rolled away. I have no problem creating another sound file that fades my current sound away.
2) I have a button which represents a knife, that should stab something (a panel) once pressed. So fist the knife must be clean. but after one or more presses, the blood should remain as a movie clip (as I want to animate the dripping blood)
3) once rolled over a button, the sound must start looping (as I wrote in 1.) AND the knife should slowly go backwards (MC). BUT when I roll mouse away, the sound fades away (as in 1. again) PLUS the knife should slowly move back to its place in stead of just jump from one place to another.
Need to make a character start to talk when the sound starts and stop talk when the sound stops so I'm using this:
[Code]...
I have a button in _level15 setting a variable (panel). I have a button loading a jpg,through loadmove, into a target. The variable is the name of that target.If I don't use the variable, here is the code I use:
on (release) {
loadMovie("../dodge/aarp1.jpg", _root._level40.panel1);
}
[code].....
I've got a movieclip(we'll call this "A") on my stage, which attaches another movieclip("B") into itself. So it's nested.Now, once this movieclip("A") has attached the other movieclip("B") into itself,It uses a "gotoAndStop()" to send the frame of movieClip("B") to the right frame, eg. frame 2. Then it runs a loop which checks for all movieclips in "B" and populates an Array.The script I'm using for this is :
Code:
for (var i=0; i<h.numChildren; i++) {// This loop is suppose to populate my "bitArray" Array with all of the attached clip's childclips
if (h.getChildAt(i) is MovieClip) {[code]....
if there were 22 MovieClips on frame 2 in movieClip"B" , this code would still be able to populate my array with all 22 clips right?It doesn't. For some reason, if there were 22 clips, then out of the 22, the loop would only pick up 9. However, doing a trace with numChildren() in movieClip"B", it would still show 22. But my array would only show 9.I've attached a sample fla, I think it would explain my problem a lot better.Once you run it, it should spit out an output telling you how many movieclips in the attached movieclip, and it'll tell you how many clips it pushed onto the array.I can't seem to get the number of movieclips in my array to equal the number of clips in total inside my attached movieclip.
I'm using this code to play/stop a sound in my flash movie, but I can't figure out how to make it loop. What do I need to do?[code]
View 3 RepliesHow you make sound affects
View 1 Repliesbut I've spent the last few days trying to find an answer to this seemingly simple question, and no luck. Well, partial luck, but not quite what I wanted.My problem is this - I want to play a random sound when an event happens. In AS2, I used to do this:Actionscript Code:s1 = new Sound();_root.s1.attachSound("sound"+(random(10)+1));s1.start();...where there would in this example be 10 sounds in the library, with names from sound1 to sound10.Now, I want to be able to do the same in AS3. As a temp solution, I've been forced to do a lot of if statements, but that's ugly, timeconsuming and inefficient.I also tried this (AS3):
Actionscript Code:
var soundArray:Array = new Array(new sound1(),new sound2(),new sound3(),new sound4(),new sound5()) var randomInteger:int var selectedSound:Sound function
[code].....
How can I pick random frame from movie clip, so that mc doesn't loop. Movie clip is a symbol. I made symbol defined it as mc, mc contains 4 frames, each frame contains some object.
View 11 RepliesI have a script that when the use types in their name, it is to pick a random name from the list. Problem is, it isn't picking random exactly I get a lot of repeats and sometimes it just comes up undefined.
Here is the script
if (combobox.getSelectedIndex() == 0)
{
txt2.text = "Female Name";
female.play();
[Code].....
i got an XML File with a set of variables which should be chosen randomly. Of course, if one data set has been selected, it should not come up again. to solve this, i created an array called blacklist, which keeps track of all the xml indexes which have allready been selected. so, what i'm doing in f_newtarget is randomize a number between 0-42 and check if it on the blacklist. if it is, i trace "double" and want to restart, and if it is not, write the randomized index to the blacklist and move my target to the coordinate given in the XML.
whats not working is when i get a double event. it traces the "double" but does not start to randomize again. i think i know why, cuz the action is only triggered by pushing the button. but in the case taht the randomized number is allready in the array, i want it to automatically re-randomize r until it finds a value which has not part of the array. what do i have to write in order for the code to jump back to where it randomizes the variable r?
or should i write like a whitelist array from which i randomely deduct the indexes? i have a button which holds the code for selecting a new question. it looks like this:
[Code]....
I need a color pick component.....where i can download it?
View 3 RepliesI need a color pick component.....where i can download it?
View 1 RepliesI've just started learning Flash and i'm looking for some help.I'm trying to create a program to allow you to pick out of 3 movies, select a day and time, how many people will be watching the movie and then show all the information.
I'm looking at having around 7 frames.My problem is that one of my buttons isn't working, I can't understand why as it is the same code (with the correct parts changed) as my other buttons which are working perfectly.
[Code]...
i am creating a web page and my problem here is that on my intro part or home part there is a sound playing but if i will go to other pages the sound should stop playing.
View 5 RepliesSo I exported a preview of my animation but the sound isn't high quality. How can I make it better quality? It doesn't sound like when I press Enter in Flash CS5.
View 2 RepliesSo i want the sound button to be both the same on and off like [code]...
So i want to know WHAT as2 code can i make to make it so out of the on &off button can be the SAME button on the SAME button can have the SAME on button SAME off button when you click the same thing.
Code: Select allimport com.greensock.*;
import com.greensock.easing.*;
TweenLite.to(mc, 2, {volume:0});
i have classes, but only one thing, how to make sound mc.
I'm trying to make a website where you can navigate by keyboard. I'm having difficulties getting the flash file to pick up the listener when upon first logging in. Here's my website: [URL] If you click on the screen you can then press the right arrow to expand the menu. when you log onto the website I want to make it right off the bat where you press the right arrow key and the menu near the top will expand.
ActionScript Code:
stop();
listen = new Object();
listen.onKeyDown = function() {
switch (Key.getCode()) {
case Key.RIGHT :
gotoAndPlay(2)
break;
}}
Key.addListener(listen)
Again, the only way to get that keylistener to pick up pressed keys is to initially click on the screen. Is there any way to get around that?
Just wanted to aovid reinventing wheels, I want the date and time picker, I know there is already a date only picker inside flash builder.
BTW: i am using flash builder 4
I have an array of movieclips and i want to put them on stage. so they have to be unique and randomly chosen.
View 1 RepliesOK, I have a flash file which has a download button. This is in a php page. We have a php session in the header named sourceID= etc....
We tried putting the following url into the flash download button same as the php links on our page - [URL] echo (int)$_GET['sourceID'] ?> but it doesnt pick up the sourceID information.
i.e what to put in the php page and what to use for the getURL link in flash.
Needed to place objects on the stage in random order, but only place each object twice. [code]...
View 0 Repliesis it possible to pick the color of a uni filled shape? If not, is it possible to retrieve the color at pixel x:0 y:0?Otherwise how do I pick that pixelcolor using bitmapdata.
View 2 RepliesMy problem is that I'm trying to pick numbers out of an array to a cardgame.
Code:
stop();
//var kort = new Array (0,1,2,3,4,5,6,7,8,9,10);
button_1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
[code]....
I have built a small flash file that has the mouse move the salt shaker on a angle, but I don't know how to make salt animate out on the plate
View 0 RepliesI load a picture file by Loader and add Bitmap into sprite,like follows:sprite1.addChild(myBitmap);Now I want to get the myBitmap from sprite1,how can I get myBitmap from sprite1,what code can I use?
View 1 Replies