1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Another noob needs AS3 help / buttons

Discussion in 'Software Development' started by FedUpWithAS3, Nov 3, 2011.

Thread Status:
Not open for further replies.
  1. FedUpWithAS3

    FedUpWithAS3 Thread Starter

    Joined:
    Nov 3, 2011
    Messages:
    1
    Yep. I'm a noob.

    But at least I had a process, in which I could make whatever I wanted.

    But now, no.
    AS3 has come along and pooped in my machine. And Adobe sits there like 'hu, what?'

    Some of you think it's awesome, powerful, great... Well... I totally disagree.
    I'd rather have the OPTION of using AS2 or 3 for a phone app... But no. Only AS3 can be used to make an app.

    So, I have this template which has 3 buttons. 1 works, it goes to a URL.
    All I want, is 1 button to play a sound, the other to stop it, while also going through frames. You'll see, I've labeled them too, just to make it easier.
    I've also duplicated the code for 'touch events' if that's even needed? Or can mouse event also be used as touch? Might be a silly question, but hey.

    http://www.sendspace.com/file/hsl4tm
    (I couldn't attach, because it's 70kb over the limit. My life is fun, 24/7.)

    All of this is doing my head in. Now I just want to become an alcoholic & forget all of this.
    Every tutorial or 'pro' seems to be... hmm, how should I put it... A tight ***? Or maybe not. They just can't explain simple processes. Some people explain things backwards, which I can't stand.

    Ahh **** it who cares.

    *edit*

    ""request" inside the new Sound() constructor needs to be a URLRequest pointing to the mp3 file you want to play. I should have made that clear." - from another site..

    Ok, so... I have to tell flash to URL request the actual mp3 file name, internally, as well as give it linkage & a button an instance name to go with it.

    That to me, is stupid. It's like... 'Double handling'. If anyone knows what that is, I'm sure you'd understand. Basically... It's a waste of time!

    That didn't work either btw.

    Here's my code now:

    stop()


    var mySound:trol1 = new trol1();

    var clapsChannel:SoundChannel = new SoundChannel();

    but_2.addEventListener(MouseEvent.CLICK, playSound);
    but_1.addEventListener(MouseEvent.CLICK, stopSound)

    function playSound(e:MouseEvent):void
    {
    mySound.play();
    }

    function stopSound(e:MouseEvent):void
    {
    clapsChannel.stop();
    }
    var myChannel:SoundChannel = new SoundChannel();

    function click1(evt:MouseEvent):void {
    flash.media.SoundMixer.stopAll()
    gotoAndStop("start");
    }

    function click2(evt:MouseEvent):void {
    mySound.play();
    gotoAndStop("intro");

    }

    ///URLs
    but_3.addEventListener(MouseEvent.CLICK,goThere);
    function goThere(e:MouseEvent){
    var request:URLRequest = new URLRequest("http://www.google.com/");
    navigateToURL(request);
    }


    /////

    but_1.addEventListener(MouseEvent.CLICK, click1);
    but_2.addEventListener(MouseEvent.CLICK, click2);


    function onTouchBegin1(event:TouchEvent) {

    gotoAndStop("start");
    myChannel.stop();
    }

    function onTouchBegin2(event:TouchEvent) {
    gotoAndStop("intro");
    }


    but_1.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin1);
    but_2.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin2);
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1025343

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice