0 Replies - 3980 Views - Last Post: 30 October 2013 - 03:18 PM

#1 eirik226  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 01-November 12

How to stop function when changing a scene qustion

Posted 30 October 2013 - 03:18 PM

Hello,

I am new to flash and trying to make a function to stop when changing from scene 2 to scene 1.

Some info:

- I have 5 scenes in my flash animation
- I have 4 buttons which changes scenes.
- 2 of the scenes are on the same button (An On/Off button)
- The flash animation I am making is a TV - you can see the TV and press ON/OFF, channel 1,2 and 3. (Channel are on different buttons)

Here is my code:

if ("Scene 2") {

import flash.display.Sprite;
import flash.events.Event;
import flash.display.Graphics;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Point;


const ww = 722.95;
const hh = 480.95;
var bgdata:BitmapData = new BitmapData(ww, hh, false, 0xffffff);
var bg:Bitmap = new Bitmap(bgdata);
var zeroPt:Point = new Point(0,0);

	bg.x = 349.60
	bg.y = 156.60
	
addChild(bg);
addEventListener(Event.ENTER_FRAME, drawBaby);

function drawBaby(e:Event) {
bgdata.lock();
bgdata.noise(Math.random() * 1000, 0, 255, 7, true);
bgdata.unlock();

} else {
}


I've taken the code from another place, not sure if allowed to link to his site, but he told people it's free to use!

Anyway, the question is in the title basically, here it is more specific:

When I press the TV from Off (Standard position) to ON it jumps to scene 2 and starts playing TV snow or white static (this is where the code comes in) but when I press the off button again it's still showing, when the TV is supposed to be off.

How do I make it so that it's going off when the TV is off?

Thanks for advance :)

Is This A Good Question/Topic? 0
  • +

Page 1 of 1