• 11
• 27
• 9
• 20
• 31

# ActionScript 3: Tutorials are always different???

This topic is 3504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm using Flex 3 with its compiler mxmlc to compile code to an swf file. However, there's something different about what all non-gamedev tutorials seem to have and my codebase My codebase is based on on a rocking article from GameDev.net btw, namely this one: http://www.gamedev.net/reference/articles/article2371.asp by Andy Fischer. The thing is, in my/gamedev's codebase, the base class inherits from "UIComponent". However not any other online tutorial mentions this "UIComponent". However, without inheriting from "UIComponent" it doesn't work for me. Why doesn't it work without inheriting from "UIComponent" for me, while all other online tutorials (other than gamedev.net's) do it without? Now the MAIN question: I've always got things like events and sound things not working the same way as in those online tutorials. Example: this is how I should be "supposed" to be able to change the sound volume:
var st:SoundTransform=new SoundTransform();
st.volume=0.2;
ns.soundTransform=st;
There is no "ns" available in my codebase! And if I just do "soundTransform=st" directly in my main class, the sound volume also still doesn't change. Why doesn't the sound volume change if I do "soundTransform=st" in the main class? And what is this "ns" that those tutorials speak about but is not available for me? This sound thing is just an example, I've met the ns in other online examples too (and strangely, sometimes it does work if I do it on my main class, but not for this volume and sometimes not for events...)

##### Share on other sites
Quote:
 Original post by LodeMy codebase is based on on a rocking article from GameDev.net btw, namely this one: http://www.gamedev.net/reference/articles/article2371.asp by Andy Fischer.The thing is, in my/gamedev's codebase, the base class inherits from "UIComponent". However not any other online tutorial mentions this "UIComponent". However, without inheriting from "UIComponent" it doesn't work for me.Why doesn't it work without inheriting from "UIComponent" for me, while all other online tutorials (other than gamedev.net's) do it without?

Presumably because the GDNet tutorial's code uses some functionality that is defined there.

Quote:
 Example: this is how I should be "supposed" to be able to change the sound volume:var st:SoundTransform=new SoundTransform();st.volume=0.2;ns.soundTransform=st;There is no "ns" available in my codebase!

Variable names are not magic. Look around in the sample code for where 'ns' is defined.

Also, consider that it might be a data member of the UIComponent that you're inheriting from. :)