ActionScript 3.0 :: Insert A Sound Inside A Class Of My Game?

Jan 3, 2012

So i am trying to insert a sound inside a class of my game. In the constructor function i declare the variable private var retDamage3:Sound = new Sound();

and in the place i want it to play i put this code retDamage3.load(new URLRequest("sfx/destruirbarra.mp3"));
retDamage3.play(); Except it gives the error:

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Instantiating Character Class Inside Of Game Class

Feb 18, 2007

I am having a problem instantiating a Character class inside of a game class.I am working on converting URL...l these tutorials to A.S. 2.0.[code]

View 2 Replies

ActionScript 3 :: Bubble Game Base Class - Sound Playing Too Late

Feb 12, 2012

Any examples of ActionScript 3.0 code that deploys any kind of sound files to be used in Flash Pro files, for final output as SWF. I am using the code (below) for the Base class of a Bubble Game (of sorts), and the problem is, that when popped, the sound plays a little too late, not spot on.

This is my code - which is linked to the Bubbles in the library of my FLA:
package {
import flash.display.*;
import flash.events.*;
import flash.media.Sound;
import flash.net.URLRequest;
public class BubbleBaseNew4 extends MovieClip {
[Code] .....

View 1 Replies

IDE :: Insert Flash Game Into Wordpress?

Oct 15, 2009

how to insert a Flash Game into Wordpress.

Flash Game is in swf file format.

kindly teach me which directory should i upload the swf file to and the source code that i need to type in Wordpress.

View 2 Replies

ActionScript 3.0 :: Make A Game, And The Character Inside The Game Could Swim

Jun 13, 2009

I was trying to make a game, and the character inside the game could swim. However, I only wanted him to swim in short bursts that refueled every time he hit the ground.

View 9 Replies

ActionScript 3.0 :: Sound Repeats From Game To Game

May 19, 2010

We have a bug in one game whereby the sound of the word repeats. Even when we use stopAllSounds - the sound is still kept in memory and you can hear it in the next activity - it's a disaster and kids get real angry.

View 3 Replies

Actionscript 3.0 :: External Preloader - If Insert 2 Frames In Start, It Will Change Entire Game Codes?

Jul 12, 2010

i've alredy made game in timeline, and i havent made preloader. if i try to insert 2 frames in start, it will change my entire game codes.

View 2 Replies

Php :: Insert A Checkbox Inside A Accordion Header In The Application (AIR)?

Oct 13, 2009

In my application i want checkbox on the accordion ,so is it possiable to set checkbox ? if it is possiable How can i identified child ?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%" height="100%">
<mx:Accordion>

[code]....

View 2 Replies

ActionScript 2.0 :: Insert XML Content Inside A Flash Movie?

Jan 29, 2007

I have a flash mp3 player that I want to embed in a page and I need to insert the data of two external .xml files in an action inside the first frame (there are some server limitations that don't allow reading of external xml, txt and js files). The action I have now is:

Code:
if (!_root.playlisturl) {
_root.playlisturl = "playlist.xml";
}
if (!_root.infourl) {
_root.infourl = "info.xml";
}

so, what I want to do is paste the contents of those two .xml files inside my Flash movie somewhere so the above script accesses them directly and does not have to call outside files. Is there a tutorial somewhere that outlines this procedure? I know that this is the contrary from what .xml is used for but I can't do much now..

View 2 Replies

ActionScript 2.0 :: INSERT SYMBOL Inside A Regular MC - Allowed?

Mar 9, 2002

are you allowed to put Insert Symbols inside of movie clips? because mine don't seem to work...

View 2 Replies

Insert A Website Or A Html Webpage Inside A Flash Movie?

May 15, 2009

how I can insert a website or a html web page inside a flash movie? I don't know, maybe inside a movieclip or a component?

View 3 Replies

Professional :: Insert HTML Code To Display Inside A Flash Page?

Jul 3, 2010

I have code that is in HTML format that I think will work. Is there a way to get it read and displayed in a flash frame? or Window?

View 8 Replies

Mp3 Player Modifications - Insert The Playlist 'track Buttons' Inside The Scrollpane On The Stage

Jul 3, 2009

I will inlcude here to code i used and a zipped folder containing all the files of my mp3 player. What i would like to do, (i am not an actionscript expert and did this following a tutorial) is to include a download button for the track which is being listened, be able to insert the playlist 'track buttons' inside the scrollpane on the stage, and sort an annoying bug which makes the music form the player continue even when i leave the section of the site where its in, keeping the music in the background running and starting a new track ontop every time i renter the section where the player is placed.

[Code]...

View 2 Replies

ActionScript 3.0 :: Sound Class Type - Cannot Convert C$ To Flash.media.Sound

Oct 25, 2009

I have some sounds in my library. They are all exported and have been given class names like C, D, E etc. I have another class that represents a button. This class stores a reference to one of the Sound in my library. I set the type for this variable to Sound. When I try to set it I get the error: cannot convert C$ to flash.media.Sound I try as Sound, for example key.note = note_array[p] as Sound; The value ends up as null.

View 2 Replies

ActionScript 3.0 :: Advanced Sound - Missing Properties Not Available In The Sound Class

Apr 23, 2010

I use this class as a base for all my streaming sound. It gives you two missing properties not available in the Sound class: a reliable soundchannel always available for referencing and a latency value indicating how long it took for your last call to play() to actually play the sound. I'll probably post it on my blog when I get the time but here it is:

[Code]...

View 8 Replies

ActionScript 3.0 :: Main Class And Game Class Structure?

Feb 19, 2011

Iīm making a game and now I wonder if itīs good practice to have a class named Main for my game. I was thinking about to have a Preloader, Console and Game classes. Now I donīt know anymore. Maybe itīs better to have a Main class that loads including a preloader, which loads Console wich loads Game.
 
Thatīs the better way to making a game application? Iīm talking about best practices.
 
why if yes there has to be a Main class that extends Sprite?

View 1 Replies

Actionscript 3 :: Sound Class Unloading Sound?

Dec 27, 2011

There must be a simple solution to stop the sound and unload it in as3.

This is not all of my code, but in short I am loading random sounds. I need certian vars to be outside of the function so I can reference them with other functions for a progress bar.

How do I unload a sound so I can load a new one using the same names without getting an error the second time its called?

I have two buttons in this test. A play Sound and a Stop Sound Button.

here is my code:

var TheSound:Sound = new Sound();
var mySoundChannel:SoundChannel = new SoundChannel();
PlayButton.addEventListener(MouseEvent.CLICK, PlaySound);

[Code]......

View 1 Replies

ActionScript 2.0 :: Symbol Can't Insert Into Insert Text

Jul 27, 2004

i have few button to let user click and the symbol will insert into the input text. i change my input box to 'symbol' but i facing the problem that i can't insert character other than symbol...

View 6 Replies

ActionScript 2.0 :: Sound Effects Not Playing On Flash Game

Jul 23, 2011

I've been working on a flash game, and recently added in sound effects. However, the sound effects only seem to play the first half-second of the audio file whenever I call on them to. I have been using the standard code.

ActionScript Code:
on (rollOver) {
if (_global.sound) {
_global.SFX1.start(0,1);
}}

But the sound effect only plays through a small amount of the audio. Also, the sound effects are not very stable, and will only play the butchered audio if there is some time in between clicking on several buttons. The odd thing is that I took the same code to another flash file, and the audio played through all the way with no problem, not requiring any additional time to play the sound effect again. I used the same code to load the sounds, which is

ActionScript Code:
onClipEvent (load) {
_global.Music1 = new Sound();
Music1.attachSound('Music1');
_global.Music2 = new Sound();
Music2.attachSound('Music2');
[Code] .....

View 8 Replies

ActionScript 2.0 :: FMX Game - Adding Sound For Wrong And Right Answer?

Apr 22, 2005

Any tutorials on adding right and wrong sounds to a game? Im making this game where on a wrong answer there is a wrong sound and on a right answer a right sound! How to get the code to do this!

View 1 Replies

ActionScript 3.0 :: URL Works Inside The Address Bar, But Not In Game O_o?

Jan 25, 2010

So, my code is as follows (not exactly though)

Code:
function setMyData(){
var setData:URLRequest = new URLRequest(//function);

[code].....

View 3 Replies

ActionScript 3.0 :: Calling A Function From An Extended Class Inside A Top Level Class

Sep 23, 2009

package{
public class Character{
protected var _hp:uint = 50; //Character Health Points
protected var _power:uint = 5; //Damage dealt

[Code].....

I`m instancing a Character and a Player in the Main Timeline, all in frame 1.
When I use: ""player.attack(character)"" it works fine by itself.

So I added the if (defender._hp <= 0) this.win() which gives me the following error:

1061: Call to a possibly undefined method win through a reference with static type Character.

"defender" is a Character instance, "this" is a Player instance and "win()" is a Player method. I try to call the Player method inside a Character method using the Player instance adding the "." and his method name

Do I really need to define the win() function in the Character class? Is there a bypass to use a subclass method in a parent class method if it`s called from an instance of the subclass?

View 6 Replies

ActionScript 3.0 :: Referencing A Textfield Inside A Movieclip Class From Document Class

Feb 3, 2009

Ok, this is one of those walls that I know once I can jump over it, I will be a much happier developer again.

I've done tons of reading, and think I have a firm understanding that the general consensus is that if you want to reference something, it needs to be added to the display list, using addChild().

I hate to be defiant, but what if I don't want to?

Or at the very least, what if I want to add a movieclip class to the stage using addChild, and then reference objects inside it?

It is much easier this way than what most people recommend - adding 15 objects via addChild, then setting the x and y for the, etc.

That said, I'm all about using classes and using as3 the way it was meant to be used. So what this is, is a best practices question I guess.

HERE ARE THE STEPS I'M TRYING:

- Create new flash document

- Draw graphic symbol bg, with text field over it, select them, convert to movieclip symbol, and export class name "box", then delete it from stage

- Add document class .as file, which simply adds that class "box" from the library, to the display list using a simple addChild()

- Set a name for that box using box.name = "test" let's say

- Do a simple trace like the following - "getChildByName('test').textFieldName" - it shows up great

- So then, I'll now try to set the text by doing this - getChildByName('test').textFieldName.text = "yo";

That last line above, is what doesn't work. I know I'm referencing wrong, but how would a pro as3 developer, reference something on the stage within a movieclip class, from the document class?

View 1 Replies

ActionScript 3.0 :: Moving A Child From A Class To A Holder Sprite Inside That Class?

Feb 12, 2009

i have a BasicMap.as that takes an Array and populates itself with the MC objects passed to it by a String reference.it inherits from Sprite, and so it just places the objects on its self.then i have a class that inherits from that class, and gives a little more functionality to it, but in order for it to do that, it needs to place the objects not on itself, but instead inside a holder Sprite, so here is my problem:

code:
package Mushroom{
import flash.display.Sprite;

[code]......

View 8 Replies

ActionScript 2.0 :: SetInterval With A Class - Function Doesn't Work Inside Class ?

Oct 7, 2004

I was wondering why my current code for calling a setInterval on a function doesn't work inside my class.I have this code inside one function, calling a second function.

intID = setInterval(selfReferential, dupe, 30, 0x000000);

The selfReferential keyword refers to the current class,but was defined previously (selfReferential = this; ).I get no errors, but the dupe() function is never called.and I had the selfReferential variable replaced with the this keyword at one point as well.

View 5 Replies

ActionScript 2.0 :: Make Class Instances Into Listeners And Broadcasters From Inside Each Class?

Jul 8, 2007

I want to know how to make class instances into listeners and broadcasters, from inside each class. Here is what I am trying specifically... part of the Proj class... (projectiles, as a matter of fact)

Code:
private function listen():Void {
u.register(this);
onUpdate = function(){
step(); // a function I have which makes the projectile move (not shown)
}
}

where "u" is another class, the Updater class with this code...

Code:
class Updater {
// const. --- make this a broadcaster
public function Updater(){

[code]....

PS: What is the syntax for using AS2 code tags instead of just "[CODE|"?

View 2 Replies

ActionScript 2.0 :: Playing Sound When Character Touches Coin In Game?

Jul 5, 2011

I'm currently making a flash game and to insert sound. The sound effect has to play everytime the character touches the coin yet the coin still has to be able to unload. I never used sound before in flash.

View 1 Replies

Flash :: Professional - Linking Sound Bytes To Game Without Having To Put It On The Stage

Apr 26, 2011

I am currently having a problem with Flash CS5. I am trying to link a sound file to my Flash game without having to put it on the stage. It would play when my character got hit by an enemy. The problem is is that when I go to edit the properties, all of the options except to play the sample are all blanked out. This is currently driving me insane as I have done everything I could think of to get around this.

View 1 Replies

ActionScript 2.0 :: Making A Tycoon Game And Have A Few Queries To Do With Controlling Sound?

Oct 17, 2009

I'm making a tycoon game and have a few queries to do with controlling sound. I have two buttons, one is my play button playBTN and my other is my stop button stopBTN. Now i want to play the song mainSong using actionscript from the second frame, but I also want to play the song without it going over the top after you release playBTN.

P.S: I'm sure the stopBTN code is:
ActionScript Code:
on(release){

[code]......

View 5 Replies

ActionScript 3.0 :: Game Runs Slowly And The Sound Effects Began To Lag?

Oct 22, 2010

I am trying to play sounds in my Flash gameAt times, the game runs slowly and the sound effects began to lagI noticed that all of the sound effects that are played using AS3 sound and soundChannel objects (which are held in an array and are triggered by a Click Event listener function) are lagging worse that sound effects which are played from within MovieClips timelines (These MovieClips are played using gotoAndPlay() which is called by a different Click Event listener function.) I am wondering why this is happening. I assume that anything done within Actionscript would be processed faster that anything done on a timeline.

View 0 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved