Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

pressing code stops working on revisiting a page

Posted on 2007-11-24
1
139 Views
Last Modified: 2010-04-03
Ive made a page on a flash cd-rom which can be panned up, down, left, right pressing buttons. The page also contains a image showreel. The page works fine on intiial visit, but if revisited the movement button cease to work. Id be grateful for any ideas? Its something about coming back to the page
this.imagelibrary.slideleft.onPress = function() {
	shifting = true;
	movero = 12;
	backero = -.9;
};
 
this.imagelibrary.slideright.onPress = function() {
	shifting = true;
	movero = -12;
	backero = .9;
};
 
 
var someListener:Object = new Object();
someListener.onMouseUp = function () { presso = false; };
Mouse.addListener(someListener)
							
 
_root.onEnterFrame = function() {
 
	
	if (presso == true) {
		this.imagelibrary._x = this.imagelibrary._x + xdirectiono;
		this.imagelibrary._y = this.imagelibrary._y + ydirectiono;
		this.imagelibrary._yscale = this.imagelibrary._yscale + yscaledo;
		this.imagelibrary._xscale = this.imagelibrary._xscale + xscaledo;
	
	}
	
	if (this.imagelibrary._yscale > 190) {
		this.imagelibrary._yscale = 190;}
	if (this.imagelibrary._xscale > 190) {
		this.imagelibrary._xscale = 190;}
		if (this.imagelibrary._xscale < 100) {
		this.imagelibrary._xscale = 100;}
		if (this.imagelibrary._yscale < 100) {
		this.imagelibrary._yscale = 100;}
		if (this.imagelibrary._y > 510) {
		this.imagelibrary._y = 510;}
		if (this.imagelibrary._y < -120) {
		this.imagelibrary._y = -120;}
		if (this.imagelibrary._x > 700) {
		this.imagelibrary._x = 700;}
		if (this.imagelibrary._x < -450) {
		this.imagelibrary._x = -450;}
		
		
	if (pressing == true) {
		_root.imagelibrary.object._x = 1733+_root.imagelibrary.scroller.scrollhead._x*-12.73 ;
	}
	if (_root.shifting == true) {
		 _root.imagelibrary.object._x = _root.imagelibrary.object._x + movero;
		 _root.imagelibrary.scroller.scrollhead._x = _root.imagelibrary.scroller.scrollhead._x + backero;
	}
	if (_root.imagelibrary.scroller.scrollhead._x < 0) {
		_root.imagelibrary.scroller.scrollhead._x = 0;
		_root.imagelibrary.object._x = 1727.5;
		shifting = false;
	movero = 0;
	backero = 0;}
	if (_root.imagelibrary.scroller.scrollhead._x > 628.5) {
		_root.imagelibrary.scroller.scrollhead._x = 628.5;
		_root.imagelibrary.object._x = -6256;
		shifting = false;
	movero = 0;
	backero = 0;}
};
 
 
left.onPress = function() {
	presso = true;
	xdirectiono = 2;
	ydirectiono = 0;
	xscaledo = 0;
	yscaledo = 0;
};
 
 
right.onPress = function() {
	presso = true;
	xdirectiono = -2;
	ydirectiono = 0;
	xscaledo = 0;
	yscaledo = 0;
};
 
big.onPress = function() {
	presso = true;
	xscaledo = 1;
	yscaledo = 1;
	xdirectiono = 0;
	ydirectiono = 0;
};
small.onPress = function() {
	presso = true;
	xscaledo = -1;
	yscaledo = -1;
	xdirectiono = 0;
	ydirectiono = 0;
};
up.onPress = function() {
	presso = true;
	xdirectiono = 0;
	ydirectiono = 2;
	xscaledo = 0;
	yscaled = 0;
};
down.onPress = function() {
	presso = true;
	xdirectiono = 0;
	ydirectiono = -2;
	xscaledo = 0;
	yscaledo = 0;
};

Open in new window

0
Comment
Question by:sousflai
1 Comment
 
LVL 23

Accepted Solution

by:
Zeffer earned 500 total points
ID: 20344103
The only anomolies I can see is that you have on line 48
if (pressing == true)..etc
yet 'pressing' has not been declared anywhere..or should that be ..presso?
and you are referencing ..shifting ..just like that through the code..except line 51 where you use _root.shifting..and if this code is not on _root then that call will look to _root for a variable that isn't there.

Z
 
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
blocked plugin flash 5 121
Flash Player Action Script Error 1090 5 216
Missing Plugin for Firefox - Can't View Content 7 178
HTML 5 video and audio or Flash 1 60
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question