Button Disappears from Stage
I’ve created a two buttons in a frame labeled
“child.” The instance name for one button is
“orientationBtn” and the other is
“stepBtn.” When you click on the orientationBtn you are
taken to a frame labeled “orientation” which holds a
puzzle written in AS3. When the puzzle is complete, two more
buttons appear. One button (playAgain) will reset the puzzle to
play again. The other button (noThanks) is a
gotoAndPlay(“child”) so the user can return to the
menu.
If the user presses a certain sequence of buttons –
orientationBtn, completes the puzzle, noThanks they are taken back
to the menu. If s/he then chooses to complete the puzzle again and
presses the same sequence of buttons, the following error message
appears after pressing the noThanks button - TypeError: Error
#1009: Cannot access a property or method of a null object
reference. Interestingly, the null object is that my
“stepBtn” has disappeared from the stage. Any ideas why
this would happen?
Of course. I should have done that initially. Sorry! You will
see that the noThanks button appears in the function
puzzleSolved at the very bottom of the code.
var puzzlePiecesArr:Array;
var puzzlePiecesFound:Array;
var topDepth:Number;
var totalPuzzlePieces:Number;
var correctPuzzlePieces:Number;
var puzzleBmp:BitmapData;
var intervalID:Number;
var threshold:Number;
var imagesArr:Array;
var imageLoader:Loader;
var requestURL:URLRequest;
var puzzleBoardClip:MovieClip;
var holder:MovieClip;
var dontPlayAgain:Button;
var doPlayAgain:Button;
init();
function init(){
dontPlayAgain = new Button();
doPlayAgain = new Button();
puzzleBoardClip = new MovieClip();
addChild(puzzleBoardClip);
totalPuzzlePieces = 8;
imagesArr = new Array("polycom_200.jpg");
puzzlePiecesArr = new Array();
puzzlePiecesFound = new Array();
correctPuzzlePieces = 0;
threshold = 0xFFFFFF;
noThanks.visible = false; //hides button
playAgain.visible = false; // hides button
congrats.visible = false;
/* Create the image Loader */
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onLoadImg);
/* Create the URL Request */
var index:Number = Math.floor(Math.random() *
imagesArr.length);
requestURL = new URLRequest(imagesArr[index]);
// Load the image
imageLoader.load(requestURL);
// Setup a holdery mc to hold the puzzle pieces
holder = new MovieClip();
addChild(holder);
function onLoadImg(evt:Event):void{
// Determine the width and height of each puzzle piece.
// Each puzzle consists of 2 columns and 4 rows.
var widthPuzzlePiece:Number = imageLoader.width / 2;
var heightPuzzlePiece:Number = imageLoader.height / 4;
// Draw the image from the movie clip into a BitmapData Obj.
puzzleBmp = new BitmapData(imageLoader.width,
imageLoader.height);
puzzleBmp.draw(imageLoader, new Matrix());
var puzzlePieceBmp:BitmapData;
var x:Number = 0;
var y:Number = 0;
// Loop 8 times to make each piece
for (var i:Number = 0; i < 8; i++)
puzzlePieceBmp = new BitmapData(widthPuzzlePiece,
heightPuzzlePiece);
puzzlePieceBmp.copyPixels(puzzleBmp, new
Rectangle(x,y,widthPuzzlePiece,heightPuzzlePiece), new Point(0,0));
makePuzzlePiece(puzzlePieceBmp, i);
x += widthPuzzlePiece;
if(x >= puzzleBmp.width)
x = 0;
y += heightPuzzlePiece;
makePuzzleBoard(puzzleBmp.width, puzzleBmp.height);
arrangePuzzlePieces();
function makePuzzlePiece(puzzlePiece:BitmapData, index:int){
var puzzlePieceClip:Bitmap = new Bitmap(puzzlePiece);
var tmp2:MovieClip = new MovieClip();
tmp2.addChild(puzzlePieceClip);
tmp2.name = String(index) // Added for Strict Mode
holder.addChild(tmp2);
holder.addEventListener("mouseDown", pieceMove);
holder.addEventListener("mouseUp", pieceMove);
puzzlePiecesArr.push(tmp2);
// This is used to check if the same piece has been placed
puzzlePiecesFound.push(tmp2.name);
function pieceMove(evt:Event):void{
if(evt.type == "mouseDown"){
evt.target.startDrag();
} else if(evt.type == "mouseUp"){
evt.target.stopDrag();
var puzzlePieceIndex:Number = evt.target.name;
// ADDED VV 4.3. Check if droppped inside of the grid
if(evt.target.dropTarget){
var puzzleBoardSpaceIndex:Number =
evt.target.dropTarget.name;
if(puzzlePieceIndex == puzzleBoardSpaceIndex)
var coordinate:Point = new Point(evt.target.dropTarget.x,
evt.target.dropTarget.y);
var coordinateGlobal:Point = new Point();
coordinateGlobal =
puzzleBoardClip.localToGlobal(coordinate);
evt.target.x = coordinateGlobal.x;
evt.target.y = coordinateGlobal.y;
if(puzzlePiecesFound.length != 0)
for(var i:int = 0;i < puzzlePiecesFound.length; i++)
if(puzzlePiecesFound
== puzzlePieceIndex)
puzzlePiecesFound = "Correct";
correctPuzzlePieces++;
if(correctPuzzlePieces == totalPuzzlePieces)
puzzleSolved();
function arrangePuzzlePieces():void
var widthPuzzlePiece:Number = puzzlePiecesArr[0].width;
var heightPuzzlePiece:Number = puzzlePiecesArr[0].height;
var locationArr:Array = new Array();
locationArr.push({x:10, y:125});
locationArr.push({x:10 + widthPuzzlePiece + 5, y:125});
locationArr.push({x:10, y:125 + heightPuzzlePiece + 5});
locationArr.push({x:10 + widthPuzzlePiece + 5, y:125 +
heightPuzzlePiece + 5});
locationArr.push({x:10, y:125 + (heightPuzzlePiece + 5) *
2});
locationArr.push({x:10 + widthPuzzlePiece + 5, y:125 +
(heightPuzzlePiece + 5) * 2});
locationArr.push({x:10, y:125 + (heightPuzzlePiece + 5) *
3});
locationArr.push({x:10 + widthPuzzlePiece + 5, y:125 +
(heightPuzzlePiece + 5) * 3});
var index:Number = 0;
var coordinates:Object;
while(locationArr.length > 0)
coordinates = locationArr.splice(Math.floor(Math.random() *
locationArr.length), 1)[0];
puzzlePiecesArr[index].x = coordinates.x;
puzzlePiecesArr[index].y = coordinates.y;
index++;
function makePuzzleBoard(width:Number, height:Number):void{
var widthPuzzlePiece:Number = width / 2;
var heightPuzzlePiece:Number = height / 4;
var puzzleBoardSpaceClip:MovieClip;
var x:Number = 0;
var y:Number = 0;
for(var i:Number = 0; i < 8; i++)
puzzleBoardSpaceClip = new MovieClip();
puzzleBoardSpaceClip.graphics.lineStyle(0);
puzzleBoardSpaceClip.graphics.beginFill(0xFFFFFF,100);
puzzleBoardSpaceClip.graphics.lineTo(widthPuzzlePiece,0);
puzzleBoardSpaceClip.graphics.lineTo(widthPuzzlePiece,heightPuzzlePiece);
puzzleBoardSpaceClip.graphics.lineTo(0,heightPuzzlePiece);
puzzleBoardSpaceClip.graphics.lineTo(0,0);
puzzleBoardSpaceClip.graphics.endFill();
puzzleBoardSpaceClip.x = x;
puzzleBoardSpaceClip.y = y;
x += widthPuzzlePiece;
if(x >= width)
x = 0;
y += heightPuzzlePiece;
puzzleBoardSpaceClip.name = String(i); // Added for Strict
Mode
puzzleBoardClip.addChild(puzzleBoardSpaceClip);
puzzleBoardClip.x = 400;
puzzleBoardClip.y = 325 - puzzleBoardClip.height/2; //was
200
function puzzleSolved():void{
holder.visible = false;
var tmp:Bitmap = new Bitmap(puzzleBmp);
puzzleBoardClip.addChild(tmp);
noThanks.visible = true;
playAgain.visible = true;
congrats.visible = true;
noThanks.addEventListener(MouseEvent.CLICK, clickDontPlay);
playAgain.addEventListener(MouseEvent.CLICK, clickPlay);
function clickDontPlay(evt2:MouseEvent):void
trace ("remove board clip");
removeChild(puzzleBoardClip);
// evt2.target.stop();
gotoAndPlay("child");
function clickPlay(event:MouseEvent):void
var timer:Timer = new Timer(50);
timer.start();
timer.addEventListener("timer", puzTrash);
function puzTrash(evt:Event):void{
if(threshold > 0xFFFFFF)
threshold = 0xFFFFFF;
evt.target.stop();
init();
puzzleBmp.threshold(puzzleBmp, new Rectangle(0,0,
puzzleBmp.width, puzzleBmp.height), new Point(0,0), "<=",
0xFF000000 | threshold);
threshold *= 1.2;
Similar Messages
-
The share button disappeared from my Facebook add-on just before I upgraded to Firefox 5.0. I thought that maybe by upgrading and reinstalling the add-on it might come back, but it didn't. All the other FB buttons are there, near as I can tell. Any ideas? I'm still using XP3.
Hello,
I had the same problem with finding this file.
There's no such file in Mac OS X version of Skype. But there's a directory for your Skype user account in /Users/%current_user_name%/Library/Application Support/Skype/
try:
quitting Skype
renaming old folder
signing into the Skype -
MovieClip disappears from stage when printing
Hi,
I am printing a parent moviclip which is on stage and has many child movieClips with linked classes having all single frames.When I try to print by passing it to printObject which is in external class few things happend as:
1. the object is printed but moviclip is removed from stage
2. also the dynamic text labels are not printed
3.the size is smaller than the original.
how to get to resovle these issues to obtain good print out from flash cs5 using AS
Any help is appreciated
srinithe only way i know to obtain pixel-perfect printing is to instantiate your printjob and using its pageWidth and pageHeight properties, (re)construct the pages you want printed, print and finally ready the no-longer-needed newly constructed pages for gc.
-
Symbol disappear from stage after being created from an image
Ok, first, I'm a beginner with Edge here, So I might be missing some obvious solution.
I want to create a button. I simply change an image to symbol (as I want to animate the buttons).
Once I do that and test it in preview, the symbol is gone. It never comes back. It's not put to
'hide'. It's in the timeline...
What am I missing?Hi Zaxist,
Thanks for wanting to help! I was going put up the project but first I wanted to trouble shooting one last time.
and... i got it to work!
I'll put the problem here in case someone runs into this issue as a beginner.
Steps to trouble shoot:
There was no code put into the button, Just a simple button.
I closed the project and made a new project just with an image and created the symbol. It worked. It was still there.
Then I went back to the project. Turn off every layer except the symbol that disappeared. When everything was turned off, I ran the preview again and the symbol was back! Then I turned each layer back on, one by one... doing previews each step. It kept showing until the last part. then it disappeared again. I then looked at the symbol closely to compare what was different from the other layers.
It was that every other layer used % instead of px at the position. The symbol used px as position and basicly jumped outside the stage.
Silly mistake but I am started to understand Edge Animate. It seems that if you use %, it's best to keep consistant with it and not mix % and px in position/sizes for the layers. -
I set up icloud last night to enable me to use my outlook calendar on my iphone. it worked. this morning, my refresh button on outlook disappeared and I can no longer sync the 2 calendars. help!
crpomy wrote:
Mine is showing in the innactive section. Need to move active. How to I do this?
Go to Tools>Trust Center>Add-Ins, at the bottom next to "Manage:" choose "COM Add-Ins" from the drop-down list and click "Go". In the next screen check "iCloud Outlook Add-In" and click OK. You may need to close and re-open Outlook for the change to take place. -
ICloud Button Disappeared from Outlook 2007
I installed iCloud on my PC running Outlook 2007. All was semi-ok with an Outlook calendar, iCloud calendar, and a merged calander. Same thing with contacts. Then a day or so later, my computer wouldn't restart unless I accepted a system restore. Now I don't have have an iCloud button in Outlook, I have no contacts at all, and no appointments in my calendar. Unfortunately, I don't backup my pst very often. It's been about a year. I've been using Outlook for about 12 years and have never had a problem, so I guess I became complacent.
I looked in deleted items, and iCloud didn't put anything there that I can see.
I can see my contacts at www.icloud.com, but I need them in Outlook. I don't have an iCloud button in Outlook to press. I went to control panel, programs, and did a repair installation on iCloud. It didn't work. How do I get my data back out of the cloud and into Outlook. If I can just see them in Outlook, I know how to back them up in a way I can trust (vs Apple's way).
Please help!I am having a similar problem where as my Outlook 2007 connection with MobleMe and now ICloud is lost and when I try to pull up my contacts and calendars I get this message: "Set of folders cannot be opened. The info store could not be opened."
Is this Outlook causing the problem? And what do I need to do to prevent this from happening,which is often.
Thanks -
I am using Firefox 22 (I like its features and do not want the features added in later version.) I have added a handful of custom URL buttons to the navigation bar that allow me to go instantly to websites I visit frequently. There was/is a function in Firefox for adding such buttons. This morning, after leaving my computer on all night, I found that the custom buttons had disappeared and I could no longer find the function for adding new ones. Can you tell me what has happened and how I can add custom URL buttons? I will appreciate your help. Thank you.
I solved my own problem. This function was added by Google Shortcuts, which somehow became disabled. After fussing ariound for a few minutes. I was able to restore it.
-
Picture frame button disappear from the lock screen
hi guys,
after updating to iOS 5.01, I can no longer find the picture frame button in the lock screen. can I get it back somewhere by tweaking in the settings? thanksAh, you mean the camera. Your original post sounded like you were asking about the photo frame/display function.
To get the camera button on the Lock screen, just double-click the Home button. -
Microphone button disappeared from iPad after I reset
There is no mic button after I reset, please help! I already tried rebooting and privacy>microphone. I need it to show for reminders, notes and other apps
Hey rehemaandchristine,
Thanks for using Apple Support Communities.
Try force quitting the apps, verify the device is up to date, last backup and restore.
iOS: Force an app to close
http://support.apple.com/kb/ht5137
Double-click the Home button.
Swipe left or right until you have located the app you wish to close.
Swipe the app's preview up to close it.
iPhone: Microphone issues
http://support.apple.com/kb/ts5183
Update to the latest version of iOS.
iOS: Back up and restore your iOS device with iCloud or iTunes
http://support.apple.com/kb/ht1766
Have a nice day,
Mario -
TS2972 the airplay button disappeared from itunes
while using itunes to play music to my apple tv I had accidentally hit computer and the airplay icon on the bottom of itunes disappeared and I have not been able to access my library on my apple tv since.
Weird, but I also though it was gone -- until I saw that it is a different, weird icon now. Look in the same spot for an icon that looks more like a square and triangle. Click on it and you'll get the Airplay functionality. Still -- why did they change it???
-
HT204291 My airplay button disappeared from iPad and iTunes. What do I do?
Thanks!
Try restarting the Apple TV by removing ALL the cables for 30 seconds, or resetting it using the reset option under general. You should also try restarting your router and other devices.
-
ICloud sync button has disappeared from Outlook
iCloud and Outlook have been syncing fine, then the sync button disappeared from Outlook. when I open the iCloud control panel a message pops up - "Repair the iCloud Control Panel to use iCloud with Outlook" - I have done this process and few times and it still reappears.
There is also no option to 'check' the syncing of mail, calenders, reminders or notes in the iCloud control panel?Hi!
Just a few questions:
- What version of Outlook do you use?
- What version of DIS? I've found two different versions of oracle.com (the latest afaik is 8.2.0.959)
- Is the addin enabled?
There are also some diagnostics available in DIS. For the moment I can't remember how to enable them, but Oracle Support can provide you with this info.
/Sam -
WD Java iView button disappears
Hello All,
We have a Webdynpro Standard iView for ESS/ MSS , we are facing the followig scenario as follows
the iView is getting display in the iView content area in the portal . We have a system tray being enabled , now when we minimise and them maximise the system tray , the button disappears from the screen (when the application is first loaded on the iView the button is displayed ). this prolem is not faced when we refresh the iView by clicking the system tray --> refresh , but only happens on the minimise and maximise action.
Tried to see, if this behaviour can be changed with changing the WD UI settings on the portal side(ctrl + secondary mouse click). but was unable to do so .
Could this be handle without touching the WD code ?
Ronnieehi
How are you using this iVew ? Have you added this iView to a page or workset ? or are you using this iView by itself ? Which object property have you changed? is it the iView or the page ?
Lemme know the details
and will take it up from there
Sheril -
I am working on a help project extracted from a .chm file. I
am unfamiliar with the creation of the original help file but when
viewing the compiled .chm file a series of topics following a
particular browse sequence (for a Quick Tour) include buttons
("Next" and "Previous") as an alternative to using the browse
sequence viewer. When viewing these pages in RoboHelp, I cannot
find any sign of these buttons, and if I edit one of these topics
in any way the buttons disappear from that topic in the compiled
.chm file. I'm trying to figure out:
1. Where I can find some sign of these buttons in Robohelp.
2. Why the buttons disappear from the .chm file when I edit
one of these topics in RoboHelp.
3. How to put these buttons back in as they are helpful in
navigating through the Quick Tour.Steve ~ Welcome to the discussions. Click once on the navigation bar to select it. Then drag the right side "handle" towards the left.
-
Apps Store and iTunes disappeared from iPhone
Hi all,
I don't know if this happened to anybody, but I downloaded an App from the store. After that, the App Store and the iTunes buttons disappeared from the home screen. Anybody has an explanation?
Thanks in Advance!Okay, figured it out. Had restrictions set to disabled. Sorry for the post.
Maybe you are looking for
-
Hello, I have multiple devices that i've used the same apple ID for. I was curious to know if I can change each of them into something different?
-
I can't post to any other forum
I tried to post to Apple.com > Support > Discussions > User Tips Library > User Tips Library and I was denied permission. ?!@## Why can I only post to Unix board? X TiG4/667 Mac OS X (10.2.x) TiG4/667 Mac OS X (10.2.x) TiG4/667 Mac OS X (10
-
Hi everyone, I really hope you can help me with this. Here's my situation... I've developed a flex application that connects to another java application using "BlazeDS". It works great!! The reason why I did this is because I'm developing (along with
-
<Moderator Message: Thread locked due to the following reasons: a) meaningless subject; b) requesting information sent to privat email; c) replies contained link farms; d) unability to search for information by yourself; e) question/request too vague
-
TREX Index not searching all entries in KM folders
Hi I am having an issue with some links\documents that are not being indexed by my TREK search service. I have an index setup and the folders and links that are manually created are indexed properly and can be searched. The issue is for online link