ActionScript 3.0 :: Converting Into Strings Into SoundChannel Instance?
Oct 30, 2009
I am trying to call a method that pulls several variables depending upon the button clicked.Depending upon the button, it will play a certain sound/song. Below is what i have so far, if anyone could figure out why i get the following error: TypeError: Error #1034: Type Coercion failed: cannot convert "test_Btn12_soundChnl" to flash.media.SoundChannel."test_Btn12" is the button that i happened to click on at that time.
Code:
public function buttonClick(e:MouseEvent):void {
playSound(MovieClip(e.currentTarget), SoundChannel(String(e.currentTarget.name) +
[code].....
View 3 Replies
Similar Posts:
May 3, 2011
I have some sounds in my library that I want to play in a soundchannel, but how? This is what I have so far:
var music:Sound = new Sound();var channel:SoundChannel = new SoundChannel();var sTransform:SoundTransform = new SoundTransform();var sound:SoundFile1 = new SoundFile1(); // Note: SoundFile1 is a class; in it is my soundfile in the library// music.load(sound); ??channel = music.play();
View 1 Replies
May 26, 2009
I'm doing the finishing touches on my games. I want to keep track of and display the level (waveCount) and display it in a dynamic text box. However, AS isn't allowing me to convert the number into a string.
[Code]...
View 1 Replies
May 26, 2009
I want to keep track of and display the level (waveCount) and display it in a dynamic text box. However, AS isn't allowing me to convert the number into a string.
PHP Code:
private var waveCount:Number = new Number();
private var waveOutput:String = new String (waveCount);
private var waveWord:Sprite = new WaveWord();
[code]....
View 5 Replies
Jan 24, 2009
I know how to read the time from a user's pc's clock, however, I'm wondering if you can break the individual digits down so they get inputted into individual text boxes, (i.e., 2 text boxes for the hours, 2 text boxes for the minutes, and 2 for the seconds... I need to convert the time somehow to strings?
View 1 Replies
Nov 24, 2009
If I have field Total.text = $5,000.00, how can I convert this to ve 5000.00 for calculations
View 2 Replies
Jan 9, 2010
How would I convert an array of strings to sprites in order to make them clickable buttons?
View 8 Replies
May 26, 2009
We're making a simple input text comparisons vs. some constant floating point numbers (e.g. 4.35). Using Actionscript 2 to Flash 9 export.
Code:
trace(typeof(Number(435/100)))
trace(typeof(Number(435/100)==4.35))
trace((Number(435/100)==4.35))
[code]...
In the order listed above, I get the following trace when I export via Flash CS3 (9.0) on my PPC mac:
number
boolean
true
true
[code]....
The same exact FLA file, unmodified, gives the following trace output on 2 different intel macs (one mac pro, one imac) using Flash CS3 (9.0).
number
boolean
false
false
[code]....
have a clue why this is giving falses for statements such as "(Number(435/100)==4.35))", "(435/100==4.35)" or "(Number(input_txt.text)==4.35000)" but ISN'T giving a false for (Number(input_txt.text)==(435/100)) (NOTE: input_txt.text is an input field which contains the string 4.35) I'm expecting the latter since they're generally intel chipsets too??
Note: once i compile the code on my PPC mac, intel macs that run the SWF (but don't recompile the FLA) do return the correct booleans that match the PPC output.
View 3 Replies
Dec 6, 2008
I just finished a simple music player... For testing purposes. I upload it in the following address:http:[url]....with 10 music songs that I had recorded from radio stations(added the last 2 twice for testing).The problem is that when a song has totally loaded, stop action taken needs about 1 second to be applied!I.e. When I press "STOP", the sound continue to play for 1 sec before stop. When I push "pause" it takes one second for the music to stop!
However when using resume (second time pause) the sound starts instantly! Thus I guess there is an issue with stop()function of the SoundChannel object that I am using to stop the sound. Also notice that when unpause the music, it continue ~one second before the last sound - which means that I saved the soundChannel.position number (and also call soundChannel.stop()) in correct time, but it didn't stop immediately - bug!?
This only happens when the application runs through a browser(plugin v. 10) - programmed in CS3.
PS1. Notice that ,this also happens when I change Volume too. Thus because Stop and Volume are parts of SoundChannel, I guess there might be a bug with SoundChannel in online plugins..... :/
PS2. Notice that ,this also happens when I close the browser (firefox). Even if browser is closed the music continue for 1 sec the same way as when pressing stop!.. Thus I guess it's flash bug!...
View 2 Replies
Nov 9, 2008
I'm trying to read date variables from an external text file. I'm using the LoadVars method and it is working fine for regular string variables. I'm running into trouble trying to convert some of those strings into date variables so I can compare the current date to the targetDateX variable from the text file. I'm working on a countdown timer for a list of different times/dates. It will display the time left until the first event, then after that event the time left until the second event. I'm running the code in a for loop and everything is working except being able to convert the string with format (yyyy,mm,dd,hh,mm) into a date variable- I've attached a sample of where I'm having trouble.
View 1 Replies
Sep 1, 2010
it is a trivial question. I was just wondering. Does the framework have a helper function that does something like this:
[Code]...
View 1 Replies
Oct 28, 2009
I have something like this as a part of my code
Code:
var gen:particle;
var a:int = 0;
var b:int = 1;
[Code]....
As you can see i am creating instances of particle and adding them stage and then giving them instance names.
Now in the empty event handler function I want to access these instances of particle I created by their instance names and change their rotationX values.
how do I call these instance names in the for loop in the second function. I can generate the string pretty easily, but how do I get flash to recognize these strings as instance names?
View 2 Replies
Oct 4, 2004
im going through ASDG, page by page, and learning everything from scratch. he's explaining datatypes, i.e. strings, numbers, booleans, arrays, etc...i get that. then he goes into explaining how to convert datatypes from numbers to strings using "toString" , and then strings to numbers using "Number()"...and then later, strings to booleans and stuff. My question is this. where someone would want to turn a number into a string or a string into a number? and how would someone even turn a string into a number? i dont understand how that works.
View 5 Replies
Jun 8, 2009
Code:
//declare variables and create arrays
var initx=80;
var inity=80;
[Code]......
Alright, what I am trying to do here is get 15 buttons arranged on the stage in a random order. The buttons are all named "butt1" "butt2" etc. First step, getting the numbers 1-15 in a random order in an array (successful). Then I concatenate "butt" before the number so the array contains the button names.
However, when I try to place them I get the following message:
ReferenceError: Error #1056: Cannot create property x on String.
at numbersgame_fla::MainTimeline/frame1()
Flash is interpreting my array values as strings rather than the buttons they are supposed to be, and failing as a result. How can I fix this?
View 2 Replies
Nov 4, 2009
I have a slider that the values are passed to a concatenated string.
Example:
trace ("object" + event.value + "_mc");
this gives me "object1_mc"
Now, what I would like to do is use that string to set the alpha to 1
Example:
object1_mc.alpha =1;
It will not work because it is a string and not a movieclip...
View 1 Replies
May 26, 2009
Building a dynamic map that displays State Senate districts for a US State. Each district is a movie clip that I want to manipulate from a ColorTransform perspective on the flash map. The data that drives the map is being pulled from a php/mysql script. I have built out the actionscript up to the point of being able to trace the name and desired highlight color of the Senate district passed from the php (the passed name corresponds to the movie clip instance name of the district on the flash map). The traces work fine as far as the values of the data passed, one field is the district and the other is the color for the transform. The .as file compiles on the test, but will not treat the variable name used for the passed district as anything other than a String. I get an Error #1069: Property transform not found on String... Have gone through adobe reference pages and have tried every method of type conversion I could find to no avail. I get coerce errors on most attempts to force the String to be an Object.
[Code]...
View 6 Replies
Jun 6, 2011
I need to instantiate them as instances of a custom class I have created. This is giving me an error, and I know I'm probably missing some simple concept somewhere, doing something wrong, but I don't know what it is.Here is my code:
In the main timeline, I have (simplified):
var puzzleAL:GeoGroup = new GeoGroup ("AL", "Alabama", 1, false);
puzzleAL.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
[code].....
View 15 Replies
Aug 24, 2009
I work on AS3 one week, and then take a break for a few weeks, then work on it a day, take a break, etc.. So I forget some of the basics, and need refreshers. I think I need to stop taking breaks.
Problem: I push multiple strings into an array, and some of the strings are the same.
Code:
var myArray = new Array();
myArray.push (Snivvle);
myArray.push (Kirupa);
myArray.push (Snivvle);
I want to find out which element positions "Snivvle" hogs up. We can see that it would be using element 0 and 2, and if we do an "indexOf" we would only get to see element 0, and doing a "lastIndexOf" we would only see element 2. How do I find out ALL of the element positions "Snivvle" is located in, so that it returns: element 0, element 2.
View 2 Replies
Mar 20, 2009
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 Replies
Apr 17, 2009
I wondered if there is a way to find out from the soundChannel the url of the sound it is currently playing. once I found out its url, i can than use its name to call something else.Or anyway to find out the sound that is playing on a soundChannel.I will know which channel to look into, but different sound will be loaded into this soundChannel.If this is not possible, i thinking along the line of overloading SoundChannel play method so that is fires an event when the sondchannel plays and also find out the name of the sound file it is currently playing.
View 2 Replies
Jun 30, 2009
I am trying to build a simple player inside my swf file. The code is a bit messy but it seems to work.I´m using a soundChannel for Playback..I´m trying to figure out how to have the player play the next song once the previous one has reached its end.Do I add some sort of EventListener to the soundChannel?[code]...
View 7 Replies
Sep 2, 2010
when do we use SoundChannel and SoundMixer?
View 3 Replies
Jan 12, 2009
i have a little flash-player with a playlist and so, it plays normally a vlc-mp3-stream but has an extended prelisten-function (wich plays the mp3's directly via http, secured with a password)i've got an array with 2 Sound()-objects (for preloading purposes), the code looks like this :
Code:
playStream = url=="";
if (playStream) {
SoundObjects[SN].load(new URLRequest("http://" + URL + ":8001/MIRstream.mp3?" + Math.random()), sloader);
} else {
[code]....
this works for the vlc stream (which is not continuos), but not for the mp3s on the http-server in my opinion, this doesn't makes sense..except, maybe the recent CSRF-hardcore-paranoia [URL]
PS: i use AS3 with flex_sdk_3.2.0.3794 and flashdevelop (i activated flash10-support, but it still works in fp9)
View 1 Replies
Dec 27, 2010
The soundChannel only plays once.Im guessing this has to do with using a class?[code]...
View 5 Replies
Jul 9, 2009
I'm having some problems with a script.I developed the app on a mac. It's intended to be both on mac and windows and also air and swf (I save data or not depending if it's installed or not).I've tested it on mac and several pc (winXP) but on win 2003 server and win 2008 server I get an error. Also on a winXP without flash player installed (through the projector) breaks at the same point.The problem is on the red line. It does always work right, sound loads, plays and when it finishes the event is called (in this case it loops). In other cases when sound completes the event should load a screen or so but, as I get an 'Error #1009: Cannot access a property or method of a null object reference' so the movie stops.I need all sounds to be inside flash so I put them in library and set their classes as com.escacs.sound.* (there are many sounds) I can't understand how mainSC can be null or undefined if the previous instruction initializes it.
[code]...
View 8 Replies
Sep 3, 2007
AS2 -> AS3 migration: doncha just love it?!have a look at the attached code. selection one makes us anew sound and gets it playting, great. then we need to adjust thevolume so we read in the files that:You can alter the volume and panning while a sound is playingby setting the pan or volume properties of a SoundTransform objectand then applying that object as the soundTransform property of aSoundChannel object.great, so selection 2 in code below should do that, right?
View 7 Replies
Sep 29, 2011
I was debugging sound in an app and decided to make a little test case as I kept getting odd errors... well I just moved to a new desk yesterday so hadn't hooked up speakers yet. Here's the test:
var backSound:Sound = new bgSound();
var backChannel:SoundChannel = backSound.play(0, 999);
trace(backChannel);
bgSound is just a library sound... if my speakers are unplugged from the sound card backChannel returns null. If speakers a plugged in backChannel is a soundChannel object.
View 1 Replies
Oct 23, 2009
so I have a lot of classes in actionscript 2. But I need to modify my application to use the soundchannel object for audio monitoring. as far as i know this is only in actionscript 3. so it it possible to write one class in AS3 and leave the rest in AS2?
if not is there a conversion tool which can make the process easier?
View 2 Replies
Jun 8, 2011
EDIT: Sorry for the question being reworded, but I am just simplifying the issue. I am not getting accurate values for SoundChannel. position for an external MP3 that is playing.I've tried a variety of audio bitrates and consistently,i am getting a SoundChannel.position that is less (~250 ms) then where the actual audio has played to. As well, the position never equals the duration. It always finishes behind, even when the SOUND_COMPLETE event is generated.
Adobe says any Sound position/duration issues are fixed with the latest Flash Player. I am obviously not getting the same results. I need very accurate position values in order to have a custom draggable timeline and cue points.
View 1 Replies
Jan 15, 2012
I have a Flex(4.6.0) application which creates 3 SoundChannels. I'd like to attach 2 of these channels to a NetStream for publishing, leaving the 3rd SoundChannel only for listening to locally.
The only audio component I can seem to attach to a NetStream is a Microphone, so I could use a Microphone loopback adapter and send ALL sound to the stream, but this would include all channels, windows sounds, sounds from other applications etc.
How do I attach individual soundchannels to a stream, or should I be going about this in a different way?
View 1 Replies