How do I return playback to the main stage timeline from a symbol?
In trying to learn Edge, is there a way to return playback (play from) once an animation is complete within a symbol?
For instance, I have the main timeline that shows a symbol animation on creationcomplete, but when the animation is finished in the symbol and I hide the symbol, the main timeline is no longer playing. What would I need to do to return playback control to resume playback of the main timeline? I have a label I would like to play from on the main timeline, but I have not found a way to call the main timeline from within the symbol.
This was something common in Flash.
Thanks for your help!
Hi escargo,
Say we use two symbols object1 and object2.
The main timeline has an interpolation on object2 from label “mainAnim“. Its autoplay property is set to false : the playhead stops at 0 ms.
A third symbol nested contains the interpolation on object1. Its autoplay property is set to true, so it plays directly.
At the end of this transition, there is a trigger (pseudo-track just below the timeline)
sym = the current symbol nested
sym.getComposition().getStage() = the main timeline (in Edge the stage is a symbol)
sym.getComposition().getStage().play(‘mainAnim’); = play the main timeline from the given label.
You can download the example here : https://app.box.com/s/6svvskydh952dfxbr3xb
Gil
PS : threads with examples for neigboring problems
http://forums.adobe.com/message/5410456#5410456
http://forums.adobe.com/message/5192205#5192205
Similar Messages
-
Making the main stage timeline play in reverse.
Hey all thanks for looking. I figured out how to do this with movie clips but I can't seem to get it right with the main stage. Can anyone tell me a simple methood of telling the stage to continue playing in reverse, after a button is clicked, until it reaches a keyframe that will tell it to stop? I'm trying to make it so buttons will tell the stage to play a transition from beginning to end and then have it play in reverse when the "back" button is pressed. I'm currently searching online to find an answer but I haven't had any luck yet. Thanks for the help!
KgIad -- tried to use this code but I am getting
TypeError: Error #2007: Parameter listener must be non-null.
Which appears to be caused by the changeTimelineF not being recognized. If I create it as
private function changeTimelineF(e:Event) {
if(startFrame<endFrame){
e.currentTarget.mc.nextFrame();
} else {
e.currentTarget.mc.prevFrame();
if(e.currentTarget.mc.currentFrame==e.currentTarget.endFrame){
e.currentTarget.removeEventListener(Event.ENTER_FRAME,changeTimelineF);
Then it is recognized--but the variables (e.g. startFrame and endFrame) are no longer valid.
What am I missing?
Thanks
Mike -
How to structure several scenes (in symbols) on the main stage timeline
Hi,
I'm new to edge animate but have a Flash background and I'm working in Edge Animate on a game which is structured in several scenes. Each scene I did put in a symbol. Now I wonder how to build the main timeline or the "story - controller" so to speak. I have all the scenes but I do not know how to connect them.
In Flash it was possible to add keyframes of scenes one after another (like stairs) and jump forward or backward if needed to load the movie clips. In Edge Animate all scenes (or symbols) are in place from the beginning of the timeline and I cannot move the symbol to a later keyframe. Of course I can move animations in the timeline. The only way I think is to hide the symbols first and make them visible if needed. But this does not seem to be the right way and I don't understand the concept of structuring complex animations yet.
I would like to know how to structure several scenes in Edge Animate properly. Something like a scene loader or unloader would be useful. Highly appriciate any hints to a solution.
Thank you,
JPresdesign wrote:
You can also use edgecommons to load edge composition into another edge composition.
Thank you to your tipp so I try to organize my scenes into compositions. I can successfully load a composition (scene2) into the main container :
EC.loadComposition("scene2.html", sym.getSymbol("mainContainer"));
Now I'm facing another situation. At the end of the loaded composition scene2 is a "Next Scene" button suppose to load scene3.html composition into the main container. "Next Scene" is a nested button inside the loaded composition screen2 symbol. How do I load the next compostion from the current one? This code for On Click of course does not work:
EC.loadComposition("scene3.html", sym.getSymbol("mainContainer"));
I think the refer to the mainContainer is wrong. Is it just a targeting issue or is it the wrong approach in general? -
Access a nested symbol timeline from the main stage
Hi all,
Would love some help on accessing a nested symbol from the main stage please.
To set the scene.....
"Its an autumn day..
no sorry...just joking...
So i have a symbol called "NormalAnatomy" - its not on the main stage, but when a button is clicked it appears in the 'content' box which is just a rectangle on the main stage.
Inside "NormalAnatomy" symbol is another symbol called "Scrub_all" which is an animation
For users to view the animation they use a scrub bar like this lovely lady has invented:
Create Click and Touch Draggable Scrubbers with Edge Animate CC | sarahjustine.com
So for Sarah Justines scrubber to work - the main stage has a lot of actions added to it. Also the "timelinePlay" symbol is on the main stage
Its starts:
var symDur = sym.getSymbol("timelinePlay").getDuration();
var mySymbol = sym.getSymbol("timelinePlay");
var scrubber = sym.$("scrubber");
var bar = sym.$("bar");
sym.$("mobileHit").hide();
var dragme = false;
So I put my "NormalAnatomy" symbol on my main stage to see if the code would work and changed all the relevant details.. and indeed it worked!
var symDur = sym.getSymbol("NormalAnatomy").getSymbol("Scrub_all").getDuration();
var mySymbol = sym.getSymbol("NormalAnatomy").getSymbol("Scrub_all");
var scrubber = sym.getSymbol("NormalAnatomy").$("scrubber");
var bar = sym.getSymbol("NormalAnatomy").$("bar");
sym.getSymbol("NormalAnatomy").$("mobileHit").hide();
var dragme = false;
But i don't want the "NormalAnatomy" symbol to be on the main stage as I want it to appear in the 'content' box only when i hit a btn
So as soon as I took this symbol off the main stage, the scrubber doesn't work. So I click a btn, and the symbol appears in the content box but the scrubber doesn't work.
so I tried in front of the "NormalAnatomy"
getStage().
getStage("content").
getComposition().getStage().
getSymbol("content").
but nothing works
The main problem must be the fact that the NormalAnatomy symbol appears inside a content box so the MainStage actions doesn't know how to find it??
So my question is... what should I put in the main stage actions to make it access the "NormalAnatomy" symbol?
Thanks for your help in advance!On click handler for the symbol use
sym.getComposition().getStage().getSymbol("nameofsymbol").play();
or
sym.getSymbol("nameofsymbol").play();
replace the italics with the literal name of the symbol as it appears in the Elements panel.
Some API details found here (http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html) in the Work With Symbols section.
Darrell -
Hello,
I'm new with edge animate, but i fell in love with it.
I'd like to know, is it possible to load different html pages dynamically in the main stage in order to avoid the preloader to be load?
I can figure out how to save all the pages of the site, but i can't merge them in a continuous animated browsing experience.
As sample.
I've got a index.html and home.html, how to switch form index to home without having a clear division between the two pages?
I can place all the animations within a file and this will allow me to have a continuous surfing experience but it won't generate specific and google indexable pages within the site.
Example, index.html will generate www.mysite.com, home will generate www.mysite.com/home. How ho switch dinamically between them and integrate them in a unique fading experience?
Thanks in advance for any help. I'm a newby, but i would like to learn.
Fea.Look into using the Loader class to load the swf files. If you want to have it happen in different frames then you can put the code into the different frames.
-
I have an iPad 1. I went to do an update on GarageBand and iBooks but it will not update. How do I return it to the original version?
Well, to paraphrase the old line, "What're you gonna believe, that email or your own lying eyes?"
The first thing I'd recommend trying is to power down your iPad (press & hold Sleep/Wake until the red OFF slider appears, then slide it to shut down), and then boot it back up and try again. You're resetting a bunch of state signals by doing that and this simple action (the first of a series recommended by Apple in your Users Guide) will quite often clear up these sorts of problems. -
How do you get back to the main screen?
How do you get back to the main screen? My little movie screen is not in the top right corner as it usually is... ever since it unexpectedly shut down. I can not edit it anymore and the screen is in the middle and the clips and sound are separated underneath. PLEASE HELP THIS PROJECT IS DUE TOMORROW AND I WAS ALMOST DONE
my limited experience tells me that different magazines work differently.
try double clicking the home button and then swiping the magazine image up off the top of the screen -
Once I view download a film from iCloud to view on my iPad, how do I return it to the cloud?
You don't. It is always there.
It's not downloaded to your iPad then deleted from iCloud. -
Switching touch events from symbols/classes to the main stage?
For previous threads:
http://forums.adobe.com/thread/864057
http://forums.adobe.com/thread/863566
http://forums.adobe.com/thread/864262
http://forums.adobe.com/thread/863597
Bug ID #2940816
I have an app that wasn't compiling correctly. I sent the bug to Adobe who responded with a workaround. However, I can't figure out how to make their stated workaround work in my code.
I have puzzle pieces on the stage. Each is assigned to a separate class. Inside the class I have touch events defining multiple touch events for each piece.
I have another spot on the stage where, when it is touched, a puzzle piece appears. These are also each linked to a separate class. Inside this class I also have touch events defining multiple touch events for each piece.
Though it works fine on my computer, it wasn't working on an iPad. Adobe said that I needed to switch the touch events so that they were assigned to the main stage instead of to each individual object.
However, the code they gave me didn't really make sense in context and I'm confused how to implement it.
This is the code in the class for each piece that is created when you touch the stage:
public function GeoPiece(): void {
if (PuzzleGlobals.currentLevel == "Name") {
this.gotoAndStop("wholeName");
else if (PuzzleGlobals.currentLevel == "Abbrev") {
this.gotoAndStop("abbrev");
else if (PuzzleGlobals.currentLevel == "Shape") {
this.gotoAndStop("shape");
this.addEventListener(TouchEvent.TOUCH_MOVE, geoPieceBegin);
public function geoPieceBegin (e:TouchEvent): void {
PuzzleGlobals.pieceActive = true;
e.target.startTouchDrag(e.touchPointID, false);
e.target.addEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
e.target.interactionBegin();
MovieClip(this.parent.parent).nameDisplay.gotoAndStop(e.target.abbrev);
PuzzleGlobals.currentPiece = e.target.abbrev;
public function geoPieceEnd (e:TouchEvent): void {
PuzzleGlobals.pieceActive = false;
if (currentObjOver.isLocked == true) {
currentObjOver.gotoAndStop ("Lock");
else {
currentObjOver.gotoAndStop ("Out");
MovieClip(this.parent.parent).nameDisplay.gotoAndStop(PuzzleGlobals.chosenPuzzle);
e.target.stopTouchDrag(e.touchPointID);
if (this.dropTarget.parent is GeoPuzzle) {
if (GeoPuzzle(this.dropTarget.parent).abbrev == e.target.abbrev) {
PuzzleGlobals.statesCompletedUSA++;
GeoPuzzle(this.dropTarget.parent).isLocked = true;
GeoPuzzle(this.dropTarget.parent).gotoAndStop("Lock");
e.target.parent.removeChild(DisplayObject(e.target));
else {
//play BOOP sound indicated wrong drop;
if (PuzzleGlobals.statesCompletedUSA == PuzzleGlobals.TOTAL_NUMBER_USA) {
//play fireworks game
else {
//do nothing
e.target.removeEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
public function interactionBegin () {
if (this.dropTarget != null && this.dropTarget.parent is GeoPuzzle) { //check to make sure it's over a puzzle piece
currentObjOver = GeoPuzzle(this.dropTarget.parent);
currentObjOver.gotoAndStop("Over");
if (lastObjOver != currentObjOver) {
if (lastObjOver.isLocked == true) {
lastObjOver.gotoAndStop("Lock");
else {
lastObjOver.gotoAndStop("Out");
lastObjOver = currentObjOver;
This is the code in the class for each piece that's already on the stage:
public function GeoPuzzle(): void {
if (this.isLocked == true) {
this.gotoAndStop ("Lock");
if (PuzzleGlobals.pieceActive == true) {
this.addEventListener(TouchEvent.TOUCH_BEGIN, geoPuzzleBegin);
public function geoPuzzleBegin (e:TouchEvent): void {
e.target.addEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
e.target.gotoAndStop("Over");
MovieClip(this.parent).nameDisplay.gotoAndStop(e.target.abbrev);
public function geoPuzzleEnd (e:TouchEvent): void {
if (e.target.isLocked == false) {
e.target.gotoAndStop("Off");
else if (e.target.isLocked == true) {
e.target.gotoAndStop("Lock");
MovieClip(this.parent).nameDisplay.gotoAndStop(PuzzleGlobals.chosenPuzzle);
e.target.removeEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
You can see that each piece (whether it's already locked on the stage or movable) reacts differently to different touch events. However, this is the code that Adobe gave me as a workaround:
this.stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchEvent);
this.stage.addEventListener(TouchEvent.TOUCH_MOVE, onTouchEvent);
this.stage.addEventListener(TouchEvent.TOUCH_END, onTouchEvent);
var beginCount:uint=0;
var moveCount:uint=0;
var endCount:uint=0;
function onTouchEvent(event:TouchEvent):void{
switch (event.type){
case TouchEvent.TOUCH_BEGIN:
trace("BEGIN")
beginCount++;
square.x = event.stageX;
square.y = event.stageY;
square.startTouchDrag(event.touchPointID, false);
break;
case TouchEvent.TOUCH_MOVE:
trace("MOVE")
moveCount++;
break;
case TouchEvent.TOUCH_END:
trace("END")
endCount++;
square.stopTouchDrag(event.touchPointID);
break;
trace("begin: "+beginCount+" move: "+moveCount+" end: "+endCount);
// countText.text = "begin: "+beginCount+" move: "+moveCount+" end: "+endCount;
This doesn't make any sense to me because it seems that it would only work if touching the stage had to react in just a single way. I have multiple pieces that need to each react differently.
1. The pieces that are locked to the stage need to highlight when touched and display their name.
2. These pieces also need to keep themselves highlighted and their names displayed when the touch is dragged off of them instead of just removed.
3. Each piece needs to be created when touching the Puzzle Piece button the stage. As these pieces are dragged, they need to highlight the pieces underneath them and unhighlight them when they are dragged off. They also need to display their own names, and lock into place when they are dragged over the correct piece.
My questions are:
1. Why don't touch events work in the compiler?
2. How can I translate my current working code's touch events to all be directly linked to the stage instead of their objects?
Thanks so much!
AmberI am going to copy and paste this answer into all of the forums I've asked this question in case some noob like me comes along and needs the answer.
I found the problem! After 3 months I finally figured out what was wrong and why my app was working in Device Central when exported as Flash 10.1 and not on my iPad when exported as AIR for iOS.
The problem is that in the Flash runtime, if a line of code returns a bug, the flash runtime says "Error, shmerror, try again next time." So I had one if, else statement that was executing when it wasn't supposed to be - only once, at the very beginning of the program. It was throwing an error. When I exported as Flash, flash didn't care, and still executed the code later when it was supposed to. But Apple won't let their programs crash. So instead of just trying that code again, Apple decided, after the first error was thrown, that it would then COMPLETELY IGNORE that line of code. So the error was in the line where the states would unhighlight themselves. Apple just shut down that line of code, that's why it wouldn't execute properly.
I ended up changing this line of code
if (lastObjOver != null && lastObjOver.isLocked == true)
which threw an error when the piece was FIRST dragged over the puzzle, to to this
if (lastObjOver.parent != null && lastObjOver.isLocked == true)
which wouldn't throw the error.
Problem solved!
If anyone else is having this problem, I suggest you do what I did. Change all your touch events to mouse events so you can run the program in the adc debugger. That's when I discovered the error being thrown. -
Problem with access into the main stage
hi, how are you guys ,, i hope you fine
here is my problem
i have file fla called "game.fla" and there are alot of frames in the main stage i wanna move it from
class called "admin" in the library but how??
i tried to this
parent.gotoAndStop(39);
but it doesn.t work i dont know why
and this is the error message
C:\Users\win7\Desktop\game1\admin1.as, Line 902 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObjectContainer.ahh sorry "
I could be more help if I had some code to look at"
here this is all the admin code
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
public class admin1 extends MovieClip
var moves:Boolean;
var points:Number;
var SCREAMING:screaming
var SOUNDCHANNEL:SoundChannel
var vx:Number;
var EATING:eating;
var CHIDORI:chidori
var WIND:wind;
public function admin1(){
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage)
public function onAddedToStage(event:Event):void
stop()
if (currentFrame ==20)
gotoAndStop(1)
WIND = new wind;
SOUNDCHANNEL = WIND.play(0,1000)
CHIDORI = new chidori
EATING = new eating
SCREAMING = new screaming
SOUNDCHANNEL = new SoundChannel
score.restrict = "0-9";
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .5;
fireball1.alpha = .5;
points=0;
hero1.stop();
quizz.stop();
animal1.stop();
evil1.stop();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
fireball1..addEventListener(MouseEvent.CLICK, onfireball1);
burger1.addEventListener(MouseEvent.CLICK, onburger1);
b1.visible = false
b2.visible = false
b3.visible = false
c1.visible = false
c2.visible = false
c3.visible = false
d1.visible = false
d2.visible = false
d3.visible = false
e1.visible = false
e2.visible = false
e3.visible = false
f1.visible = false
f2.visible = false
f3.visible = false
a1.addEventListener(MouseEvent.CLICK, onmouseclicka1);
a2.addEventListener(MouseEvent.CLICK, onmouseclicka2);
a3.addEventListener(MouseEvent.CLICK, onmouseclicka3);
b1.addEventListener(MouseEvent.CLICK, onmouseclickb1);
b2.addEventListener(MouseEvent.CLICK, onmouseclickb2);
b3.addEventListener(MouseEvent.CLICK, onmouseclickb3);
c1.addEventListener(MouseEvent.CLICK, onmouseclickc1);
c2.addEventListener(MouseEvent.CLICK, onmouseclickc2);
c3.addEventListener(MouseEvent.CLICK, onmouseclickc3);
d1.addEventListener(MouseEvent.CLICK, onmouseclickd1);
d2.addEventListener(MouseEvent.CLICK, onmouseclickd2);
d3.addEventListener(MouseEvent.CLICK, onmouseclickd3);
e1.addEventListener(MouseEvent.CLICK, onmouseclicke1);
e2.addEventListener(MouseEvent.CLICK, onmouseclicke2);
e3.addEventListener(MouseEvent.CLICK, onmouseclicke3);
f1.addEventListener(MouseEvent.CLICK, onmouseclickf1);
f2.addEventListener(MouseEvent.CLICK, onmouseclickf2);
f3.addEventListener(MouseEvent.CLICK, onmouseclickf3);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
public function onRemovedFromStage(event:Event):void
//Remove the onEnterFrame event if
//this object is removed from the stage
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
trace("Dungeon removed");
public function onEnterFrame(event:Event):void
if (points == 0 ){
fireball1.alpha = .3;
fireball1.enabled = false;
burger1.alpha = .3;
burger1.enabled = false;
if (points == 1 ){
fireball1.alpha = .3;
fireball1.enabled = false;
burger1.alpha = 1;
burger1.enabled = true;
if (herobar.width == 80){
hero1.gotoAndStop(1);}
if (herobar.width == 60){
hero1.gotoAndStop(2);}
else if (herobar.width == 40){
hero1.gotoAndStop(3);}
else if (herobar.width == 20){
hero1.gotoAndStop(4);}
else if (herobar.width == 0){
hero1.gotoAndStop(5);}
if(evilbar.width == 40)
evil1.gotoAndStop (2)
else if (evilbar.width == 0){
evil1.gotoAndStop(3);}
public function onmouseclicka1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
removeEventListener (MouseEvent.CLICK,onmouseclicka1)
quizz.gotoAndStop(2);
animal1.gotoAndStop(2);
removeChild(a1)
removeChild(a2)
removeChild(a3)
b1.visible = true
b2.visible = true
b3.visible = true
herobar.width -= 20;
play();
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicka2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
removeEventListener (MouseEvent.CLICK,onmouseclicka2)
quizz.gotoAndStop(2);
animal1.gotoAndStop(2);
removeChild(a1)
removeChild(a2)
removeChild(a3)
b1.visible = true
b2.visible = true
b3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicka3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
removeEventListener (MouseEvent.CLICK,onmouseclicka3)
quizz.gotoAndStop(2);
animal1.gotoAndStop(2);
removeChild(a1)
removeChild(a2)
removeChild(a3)
b1.visible = true
b2.visible = true
b3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickb1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.frame.gotoAndStop(3);
animal1.gotoAndStop(3);
removeChild(b1)
removeChild(b2)
removeChild(b3)
c1.visible = true
c2.visible = true
c3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickb2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(3);
animal1.gotoAndStop(3);
removeChild(b1)
removeChild(b2)
removeChild(b3)
c1.visible = true
c2.visible = true
c3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickb3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(3);
animal1.gotoAndStop(3);
removeChild(b1)
removeChild(b2)
removeChild(b3)
c1.visible = true
c2.visible = true
c3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
}public function onmouseclickc1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(4);
animal1.gotoAndStop(4);
removeChild(c1)
removeChild(c2)
removeChild(c3)
d1.visible = true
d2.visible = true
d3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickc2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(4);
animal1.gotoAndStop(4);
removeChild(c1)
removeChild(c2)
removeChild(c3)
d1.visible = true
d2.visible = true
d3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickc3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(4);
animal1.gotoAndStop(4);
removeChild(c1)
removeChild(c2)
removeChild(c3)
d1.visible = true
d2.visible = true
d3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
}public function onmouseclickd1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(5);
animal1.gotoAndStop(5);
removeChild(d1)
removeChild(d2)
removeChild(d3)
e1.visible = true
e2.visible = true
e3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickd2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(5);
animal1.gotoAndStop(5);
removeChild(d1)
removeChild(d2)
removeChild(d3)
e1.visible = true
e2.visible = true
e3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickd3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(5);
animal1.gotoAndStop(5);
removeChild(d1)
removeChild(d2)
removeChild(d3)
e1.visible = true
e2.visible = true
e3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
}public function onmouseclicke1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(6);
animal1.gotoAndStop(6);
removeChild(e1)
removeChild(e2)
removeChild(e3)
f1.visible = true
f2.visible = true
f3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicke2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(6);
animal1.gotoAndStop(6);
removeChild(e1)
removeChild(e2)
removeChild(e3)
f1.visible = true
f2.visible = true
f3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicke3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(6);
animal1.gotoAndStop(6);
removeChild(e1)
removeChild(e2)
removeChild(e3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickf1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(7);
animal1.gotoAndStop(7);
removeChild(f1)
removeChild(f2)
removeChild(f3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickf2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(7);
animal1.gotoAndStop(7);
removeChild(f1)
removeChild(f2)
removeChild(f3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickf3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(7);
animal1.gotoAndStop(7);
removeChild(f1)
removeChild(f2)
removeChild(f3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onfireball1(event:MouseEvent):void{
if ( points >= 2 ){
points -= 2
evilbar.width -=40
SOUNDCHANNEL = SCREAMING.play();
parent.gotoAndPlay(39)
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
public function onburger1(event:MouseEvent):void{
if (points == 1 ){
burger1.alpha = .3;
fireball1.alpha = .3;
burger1.enabled = false;
fireball1.enabled = false;
herobar.width +=20
SOUNDCHANNEL = EATING.play()
points--
if ( points >= 2 ){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
herobar.width +=20
points--
SOUNDCHANNEL = EATING.play()
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
if (herobar.width >= 80){
herobar.width = 80}
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0; -
Targeting A MovieClip on the main Stage....Scope Issue
main stage------>MC1------>MC2
on MC2's timeline I want to target objects on the main stage. Not sure on how to write that without using root. I've been trying deviations of
MovieClip(parent).MovieClip(parent).mcName.
ThanksWhy can't you just use root?
And you can just put your code in the main timeline as suggested - just dispatch an event when you want your code to run and listen for it.
So, in your clip, on whatever frame do something like:
dispatchEvent(new Event("runMyAnim"));
And in the main timeline:
someClip.someClip.addEventListener("runMyAnim", runIt, false, 0, true);
function runIt(e:Event){
//your code goes here -
Bug fix requires switching touch events from symbols/classes to the main stage?
Also posted in Mobile Development, I'm still not sure which forum I should be in.
For previous threads:
http://forums.adobe.com/thread/864057
http://forums.adobe.com/thread/863566
http://forums.adobe.com/thread/864262
http://forums.adobe.com/thread/863597
Bug ID #2940816
I have an app that wasn't compiling correctly. I sent the bug to Adobe who responded with a workaround. However, I can't figure out how to make their stated workaround work in my code.
I have puzzle pieces on the stage. Each is assigned to a separate class. Inside the class I have touch events defining multiple touch events for each piece.
I have another spot on the stage where, when it is touched, a puzzle piece appears. These are also each linked to a separate class. Inside this class I also have touch events defining multiple touch events for each piece.
Though it works fine on my computer, it wasn't working on an iPad. Adobe said that I needed to switch the touch events so that they were assigned to the main stage instead of to each individual object.
However, the code they gave me didn't really make sense in context and I'm confused how to implement it.
This is the code in the class for each piece that is created when you touch the stage:
public function GeoPiece(): void {
if (PuzzleGlobals.currentLevel == "Name") {
this.gotoAndStop("wholeName");
else if (PuzzleGlobals.currentLevel == "Abbrev") {
this.gotoAndStop("abbrev");
else if (PuzzleGlobals.currentLevel == "Shape") {
this.gotoAndStop("shape");
this.addEventListener(TouchEvent.TOUCH_MOVE, geoPieceBegin);
public function geoPieceBegin (e:TouchEvent): void {
PuzzleGlobals.pieceActive = true;
e.target.startTouchDrag(e.touchPointID, false);
e.target.addEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
e.target.interactionBegin();
MovieClip(this.parent.parent).nameDisplay.gotoAndStop(e.target.abbrev );
PuzzleGlobals.currentPiece = e.target.abbrev;
public function geoPieceEnd (e:TouchEvent): void {
PuzzleGlobals.pieceActive = false;
if (currentObjOver.isLocked == true) {
currentObjOver.gotoAndStop ("Lock");
else {
currentObjOver.gotoAndStop ("Out");
MovieClip(this.parent.parent).nameDisplay.gotoAndStop(PuzzleGlobals.c hosenPuzzle);
e.target.stopTouchDrag(e.touchPointID);
if (this.dropTarget.parent is GeoPuzzle) {
if (GeoPuzzle(this.dropTarget.parent).abbrev == e.target.abbrev) {
PuzzleGlobals.statesCompletedUSA++;
GeoPuzzle(this.dropTarget.parent).isLocked = true;
GeoPuzzle(this.dropTarget.parent).gotoAndStop("Lock");
e.target.parent.removeChild(DisplayObject(e.target));
else {
//play BOOP sound indicated wrong drop;
if (PuzzleGlobals.statesCompletedUSA == PuzzleGlobals.TOTAL_NUMBER_USA) {
//play fireworks game
else {
//do nothing
e.target.removeEventListener(TouchEvent.TOUCH_END, geoPieceEnd);
public function interactionBegin () {
if (this.dropTarget != null && this.dropTarget.parent is GeoPuzzle) { //check to make sure it's over a puzzle piece
currentObjOver = GeoPuzzle(this.dropTarget.parent);
currentObjOver.gotoAndStop("Over");
if (lastObjOver != currentObjOver) {
if (lastObjOver.isLocked == true) {
lastObjOver.gotoAndStop("Lock");
else {
lastObjOver.gotoAndStop("Out");
lastObjOver = currentObjOver;
This is the code in the class for each piece that's already on the stage:
public function GeoPuzzle(): void {
if (this.isLocked == true) {
this.gotoAndStop ("Lock");
if (PuzzleGlobals.pieceActive == true) {
this.addEventListener(TouchEvent.TOUCH_BEGIN, geoPuzzleBegin);
public function geoPuzzleBegin (e:TouchEvent): void {
e.target.addEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
e.target.gotoAndStop("Over");
MovieClip(this.parent).nameDisplay.gotoAndStop(e.target.abbrev);
public function geoPuzzleEnd (e:TouchEvent): void {
if (e.target.isLocked == false) {
e.target.gotoAndStop("Off");
else if (e.target.isLocked == true) {
e.target.gotoAndStop("Lock");
MovieClip(this.parent).nameDisplay.gotoAndStop(PuzzleGlobals.chosenPu zzle);
e.target.removeEventListener(TouchEvent.TOUCH_END, geoPuzzleEnd);
You can see that each piece (whether it's already locked on the stage or movable) reacts differently to different touch events. However, this is the code that Adobe gave me as a workaround:
this.stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchEvent);
this.stage.addEventListener(TouchEvent.TOUCH_MOVE, onTouchEvent);
this.stage.addEventListener(TouchEvent.TOUCH_END, onTouchEvent);
var beginCount:uint=0;
var moveCount:uint=0;
var endCount:uint=0;
function onTouchEvent(event:TouchEvent):void{
switch (event.type){
case TouchEvent.TOUCH_BEGIN:
&nbs p; &n bsp; trace("BEGIN")
&nbs p; &n bsp; beginCount++;
&nbs p; &n bsp; square.x = event.stageX;
&nbs p; &n bsp; square.y = event.stageY;
&nbs p; &n bsp; square.startTouchDrag(event.touchPointID, false);
&nbs p; &n bsp; break;
case TouchEvent.TOUCH_MOVE:
&nbs p; &n bsp; trace("MOVE")
&nbs p; &n bsp; moveCount++;
&nbs p; &n bsp; break;
case TouchEvent.TOUCH_END:
&nbs p; &n bsp; trace("END")
&nbs p; &n bsp; endCount++;
&nbs p; &n bsp; square.stopTouchDrag(event.touchPointID);
&nbs p; &n bsp; break;
trace("begin: "+beginCount+" move: "+moveCount+" end: "+endCount);
// countText.text = "begin: "+beginCount+" move: "+moveCount+" end: "+endCount;
This doesn't make any sense to me because it seems that it would only work if touching the stage had to react in just a single way. I have multiple pieces that need to each react differently.
1. The pieces that are locked to the stage need to highlight when touched and display their name.
2. These pieces also need to keep themselves highlighted and their names displayed when the touch is dragged off of them instead of just removed.
3. Each piece needs to be created when touching the Puzzle Piece button the stage. As these pieces are dragged, they need to highlight the pieces underneath them and unhighlight them when they are dragged off. They also need to display their own names, and lock into place when they are dragged over the correct piece.
My questions are:
1. Why don't touch events work in the compiler?
2. How can I translate my current working code's touch events to all be directly linked to the stage instead of their objects?
Thanks so much!
AmberSure!
I haven't changed much. I've been playing around and I think I know where the problem is coming from now. I just can't figure out how to fix it.
This it the only code I've modified:
public function interactionBegin () {
trace ("Current: " + currentObjOver);
trace ("Last: " + lastObjOver);
if (this.dropTarget != null && this.dropTarget.parent is GeoPuzzle) { //check to make sure it's over a puzzle piece
currentObjOver = GeoPuzzle(this.dropTarget.parent); //make "currentObjOver" assigned to the puzzle piece the finger is currently touching
currentObjOver.gotoAndStop("Over"); //highlight the current piece
if (currentObjOver != lastObjOver) { //if your finger moves and you're now touching a different state
if (lastObjOver != null && lastObjOver.isLocked == true) { //if the previous state you were touching has been solved
lastObjOver.gotoAndStop("Lock"); //lock this state into place
else if (lastObjOver != null && lastObjOver.isLocked == false) { //if the previous state you were touching wasn't solved
lastObjOver.gotoAndStop("Off"); //unhighlight that state
lastObjOver = currentObjOver; //assign the current state to be the last state you were touching
lastObjOver and currentObjOver are always assigned the same object. I can't figure out why, I've run it line by line but I can't figure out where I'm going wrong. -
How do I get rid of the auto signature "sent from my iPhone" when I create a new message?
how do I get rid of the auto signature "sent from my iPhone" when I create a new message?
Settings -> Mail -> Signature and edit it to whatever you'd like.
-
how do you change back to the south african store from the american store on your settings??
Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region...change here.
-
Horizontal Scrolls on the main Stage
Hi
I am putting 11 movies containing 11 flv files on my main
stage. All those movies have onMouse over and click events attached
with them. As those movies are not going to fit on the main stage
so when i am running the flash file, it is just displaying 5 of the
11 movies and rest are being cut. Is there any way that I can code
so that I will get the horizontal scrolls automatically if the
movies are not going to fit on the screen? I am new to the 'stage'
and AS3 concepts . Please help me out.
All I need is to put 11 movies on the main stage with the
horizontal scrolls.
Thanks in advance for your help
regards
Anujyou can check a similar thread involving a scrolling
movieclip:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=665&threadid =1324923&enterthread=y
Maybe you are looking for
-
Error: Total menu duration exceeds 7:30 minutes
I was set to burn my DVD when told of errors in my project. I was directed to the DVD map where at the root menu the error was as described in the subject above. Help wanted to solve please.
-
Hoax warning: fake Telstra PDF email bills
We’ve recently become aware of a hoax notification email notifying customers their PDF and/or online bill is now available. It may also request additional information about your account be sent through. What should I look out for? - If there is no na
-
No tables displayed on the Data Dictionary Import Wizard
Hello, I'm using Oracle Database 10g Express Edition and Oracle SQL Developer Data Modeler v3.0.0.665. I'm trying to import a Data Dictionary via the Data Dictionary Import Wizard. I can connect to the database ok and I can select the required schema
-
The sorting of the print preview and the print itself is different to the sorting of the folder! What can i do? The pictures in the album are sorted by the filename and shown in the right order on the screen but not on the print preview. Thx
-
Basic mode makes my ipod crash
I just bought my Nike+, and every time I try to start it in Basic mode, my ipod has to restart. Some people have mentioned it might be a problem with ipod software version 1.1.13 (I think), but I haven't been able to find any good information on how