Edge Animate CC :: If Else Statement With Mouse Click
Jan 20, 2013
I'm having a problem with IF ELSE code use with a mouse click. What I want each time a user "clicks" i want to execute a particular block of code, up to 3 clicks, then nothing. I've tried local and global click counter var but can't seem to get past the first "if". This is what I have now (I'm using console.log() to keep track.
In comp ready i create a global var ...
// insert code to be run when the composition is fully loaded heresym.getComposition().getStage().setVariable('clickcnt', 1); //set counter to 1
var i = sym.getComposition().getStage().getVariable('clickcnt');
console.log ("Counter is starting at "+i);
on the stage i create a "click" event..
// insert code for mouse click herevar i = (sym.getComposition().getStage().getVariable('clickcnt'); if (i=1){ console.log("counter is = "+i); //do some code sym.getComposition().getStage().setVariable('clickcnt', 2); //set counter to 2 } else if (i=2){ console.log("counter is = "+i); //do some code sym.getComposition().getStage().setVariable('clickcnt', 3); //set counter to 3 } else if (i=3){ console.log("counter is = "+i); //do some code sym.getComposition().getStage().setVariable('clickcnt', 4); //set counter to 4 taking it out of range sym.play(100); //play the timeline animation } else { //
I'm using this to negate any further clicks. I'm sure there's a proper way to do this. I just don't know it. sym.stop(1000); console.log("end"); };I When I run this It never gets passed the first if, It's like the "clickcnt" var is not getting updated or read properly.
I found a really good tutorial here for how to create childsymbols on a mouse click and it works fine - as long as you are doing it on the main stage.
Here is the code:
var circle = sym.createChildSymbol("flower", "Rectangle"); var circleElement = circle.getSymbolElement(); var posX = (e.pageX- ($(circleElement).width()/2)) + "px"; var posY = (e.pageY- ($(circleElement).height()/2)) + "px"; sym.$(circleElement).css({"position":"absolute", "top":posY, "left":posX});
I wanted to create the ChildSymbols on to a premade symbol I have called 'Rectangle'. This works as long as my symbol 'Rectangle' is the same size as the Stage or at least placed at the top left of the screen.
However if I move the symbol 'Rectangle' away from the 0,0 coordinates then the Child symbols appear offset by the distance that 'Rectangle is from the zero point.
How to keep the Child symbols where I want them to be on the Rectangle? I tried calling the childSymbol like this:
var circle = sym.createChildSymbol("flower", "Stage");
And that keeps the symbols where they should be, but for some reason it has a performance lag and also means that you can't click within the bounds of a generated childSymbol.
Everytime i open Adobe Edge Animate, it takes a good minute or too to stop the spinning ball. Then after every mouse click, it spins for another couple of minutes, and so on. I have tried creating the launchd.conf file with the proxy information, I have uninstalled and installed numerous times. I am working from CC with a Mac Book Pro Retina, 15-inch, Early 2013 OSX 10.8.5. I am having no other issues with any of my other applications and them being responsive.
I am trying to create an instance of a symbol at the mouse location when i click - anywhere on stage. I think it should be something like the following:
//stage on.click function
// Create an instance element of a symbol as a child of the // given parent element //premade code: var mySymbolObject = sym.createChildSymbol("Symbol_1", "ParentElement1"); var mySymbolObject = sym.createChildSymbol("Symbol_1", "Mouse");
This doesn't work of course because the mouse isn't a symbol.
I followed the tutorial on this page: [URL]. However, my animation auto plays and mousing over has no effect. I have searched and sreached to no understandable (to me) avail. Here's a link to the file: [URL]
The Elements window in Edge Animate seems to be unstable. When I right-click in the field to modify an asset, Edge often crashes with the resulting error message:
Edge Animate - Exception An error occurred. Please save your work and restart Edge Animate.
I have a crosshair like in a lightgun style game at an arcade. What code would I use to have the symbol follow the mouse, and if at all possible, could the symbol's origin be in the middle of the symbol and not in top left corner of the symbol?
I have this animated menu, when I click one of the buttons the animation to show some information starts, but when I move the mouse, the animation goes straight to the beginning so i can't continue intercting with it, that shouldn't happen, what do you think it is?
i need to control the timeline animation with the mouse wheel.i've tried this code but I've could only make it work with mouse move, unfortunatly the scroll does not work -
So I have an interactive piece with several shapes. There are about 5 rectangles, 3 horizontal and 2 vertical. For aesthetics and to fit them all in the space (stage), they overlap slightly. Whenever you mouseover a single rectangle it pushes the other rectangles away and a text bubble appears. When you mouseout, the text box goes away and the rectangles return to their original position. This worked without glitches when I applied it to the first rectangle. Now that I'm applying this to all of the other rectangles, I'm running into trouble. I'm thinking the trouble is with the overlapping portion. If you hover one rectangle where it overlaps another rectangle for a split second it plays the correct animation but then I think it tries to also play the animation for the other overlapping rectangle that appears underneath.
So my question is, what is the best way to remedy this problem? On mouseover can I temporaily disable mouse events for the other rectangles once one has been triggered? And then maybe re-enable them on mouseout? Is there a way for the rectangle that is visually on top to be the one that recieves the mouseover event?
My first time using Edge. I exported an html file from Muse & just wanted to animate some buttons on the page sliding in. But when I click on anything thats a button (from Muse) I get the Exception Error message "An error occured. Please save your work and restart Edge Animate"
It seems to happen to anything in the file that has more that one state. Is this something that I cant do in Edge?I've tried restarting. saving as a different file in a different location. uninstalling/re-installing Edge.
Not sure if it matters: The buttons that I'm trying to animate were not automatically created from a Muse Widget. I made the different states in Photoshop & imported as a photoshop button.
When I try to add a click event on a symbol, I can't access to the symbol, only to the parent. For example, if on the event click on a specific symbol A I add the code
var symbolElement = sym.getSymbolElement(); symbolElement.hide();
It will hide the parent of A, instead of hiding A. How do I access to A?
I have a banner I have been working on with three spinners like a slot machine. Currently I have everything hand animated to rotate the spinners to spin to one of 4 options each. What I would like is to have a button that triggers the spinners to rotate to a random ( 1 of 4 ) points over the course of 1/2 second 500ns.
Is there a code snippit that will make an object rotate to one of 4 chosen variables?
How do I reference `this` when a symbol is clicked? I have a click event on 'alien' on the stage. In the handler, sym appears to be stage and not 'this'.
I want it to play itself (amoung other things) when clicked.
e.target gets me the element, but not the edge symbol so I can play itself.
I'm trying to make an interactive animation where when the user clicks and moves the mouse around an area, the opacity of that part of the layer decreases and the user gets to see the background layer. It's similar to the idea of using a brush to clean a dirty window.
I have a list of menu items. I want them to change color when the user rolls over any of the six menu items. I want to write a function so it would be
var = menuTarget; (this is the item the user is currently mouseovering how do I define this?) menuTarget.mouseover(function(){ $(this).css("color","red"); }) menuTarget.mouseout(function(){ $(this).css("color","green"); })
I am creating a slide show and I added a stop and click to play action so it is interactive so the user must click to go to the next slide. The stop is working but the click an day is not when I preview in the browser?
I have a button on the main stage with a hit event inside of it. This hit area calls frame lables on other symbols (these "other symbols" are also on the main stage, not dynamic) . How do I make the click event of the hit area null if one of these symbols is/are visible? I added another button to set the visibility to false but then I also need the click event to reset itself to it's original state
I just can’t get it to work through edge, basically I have a button and I want to be able to click the button which then in turn downloads a file from the site, It’s a PDF file and I have tried the window.open() command but I get funny results once it opens? Basically I just want the button to be clicked and the file to be downloaded to the machine.
i have a problem with an animation in Edge Animate. I try to animate a button which spins 45° on mouse over and back on mouse out. So far no problem. Now i want the button to spin 90° when i click on it and let it stay on this position. I made it spin the 90° but it always spins back on mouse out because the event is still there. Is there any possibility to delet the mouse out event or pause it after clicking on the button. I already tried remove it but without any sucess.
In Edge, I have created an application where a user can click buttons and then it takes them to a separate scene. However, I seem to have run into a problem where the click only works in a certain area of the box. I created the buttons in Photoshop and imported them to Edge. Only the edge of the button closest to the edge of the stage will work for clicking for some odd reason.
I have an image of a room, and I want to add the ability to click different parts to zoom in (by scaling up background image) and have the relevant information appear. I don't know if the best way is to have all the "camera zooms" and information on one timeline (have to manually animate everything dissapearing, fiddly), or to separate them into symbols and call them up?
Is there a way to code certain regions of an image for a click event without adding a hit area?I have a map of Texas with each region. Clicking on a region brings this region bigger to the front. Then I want a click event for each county to bring up its name and other data.
I want to have a mouseover and -out effect on my navigation bar and on the event click it should stay in the mouseover status. So far the mouseout and the click event affect each other on a wrong way. The example I attached here is done with plain rectangles, but later they will be images.