ActionScript 2.0 :: Creating Controls - Button OnPress Function
Jan 9, 2010
I'm doing a school project in flash that basically has to be a movie trailer, just several photos compiled together with some music. I got bored and now am making controls in Actionscript. I'm using CS4, however I have the document based in Actionscript 2.0. Basically, I have created a rewind button that goes backwards, however now I want it to do one of the two things:
If the video was playing when the button was pressed, I want it to go back to playing when released. If the video was paused the the button was pressed, I want it to continue to stay paused when released. I've tried some very basic if statements, trying to assign boolean statements, but I'm stuck. Here's what I have thus far for my rewind button:
Code:
rewind_button.onPress = function () {
onEnterFrame = function() {
prevFrame();
}}
rewind_button.onRelease = function () {
delete onEnterFrame;
play();
}}
View 3 Replies
Similar Posts:
Jun 14, 2010
I am making an interactive map and am having trouble creating map controls such as a zoom sliding bar and a panning function.
View 1 Replies
Apr 1, 2005
Code:
goto = function(where:String) {
getURL("[URL]"+where+".htm","_self");
} button1.onRelease = goto("home");
When the movie loads, flash immediately 'getURL' before I press my button1. how come the code execute even before i press it 1st?
View 6 Replies
Nov 5, 2007
[URL]
First, click on the Abaco island shape on the map. You'll see on rollOver there is a glow around the island. Now click on that island and the glow remains for the zoomed-in detailed view. When you return to map and zoom back out, the glow is removed.
Now, compare this with clicking on the island name "Abaco" from the list on the right, instead of clicking directly on the island from the map. It zooms in and shows the details fine, but the glow that should be there is not.
The reason this problem is very perplexing for me, is that the onPress action of the list button in the right column calls the onPress function of the map button. So, theoretically they should do the EXACT same thing when pushed. But clearly they don't.
Here is the code for the button from the list on the right panel:
Code:
listAbaco_mc.onRollOver = function() {
_root.map_mc.abaco_mc.button_btn.onRollOver();
};
[Code]....
There is more code, for example rollOver, rollOut, and Press actions for the other island buttons, but they are all of the exact same format as the Abaco island button and they all have the same problem.
So, to recap, the problem is that the list button in the right panel do not function properly onPress, even though they are calling the onPress function of the island buttons directly, and the island button onPress function works perfectly. Strangely, all but one little thing works. So it's obviously getting to the correct functions and going through the code as planned, yet that one part about the glow is being ignored or otherwise messed up.
View 12 Replies
Feb 6, 2012
I was looking into creating iOS-apps (especially for the iPad) with the Adobe-Flex framework. It looks very promising to code apps this way. Is it possible to create own controls/widgets? In the far future I might want to create my own kind of gantt-calender or whatever. Is something like this possible and are there any good tutorials/book out there?
UPDATE: I want to create iOS Components that I can use in Flex. Controls, that are not aviable by default in Flex. Is that possible? By derivating or something?
UPDATE 2: In the meanwhile I found FlexLib to be useful. How hard is it to create stuff like this on your own? Especially for mobile devices. Are there any good tutorials, books, etc.
View 2 Replies
Jan 17, 2010
how to do so by clicking on the button movieclip moved to x = 100; and when pressed repeatedly to x =- 150 event onRelease - not work:
[Code]...
View 9 Replies
Sep 29, 2011
I need to make a menu (sort of like a game main menu) that the user can either use the mouse to click on the buttons, or they can use the up and down keys on the keyboard to navigate the menu and use enter to select the button. Like, a game menu.
View 5 Replies
Oct 27, 2011
I got a simple block of code that stops the main timeline on a certain frame, but so far I've been unable to form a code that would gotoAndPlay when mouse click happens on a button I made, and mind you I'm doing this in a document class. I've heard different instructions how to make the button, some say make it a movieclip, some say nest it in a movieclip
View 6 Replies
Feb 16, 2009
I'm trying to add an onPress function to something that I've just dynamically attached to the stage.
ActionScript Code:
item.attachMovie("close_btn", close_btn, this.getNextHighestDepth());
View 9 Replies
Feb 16, 2009
I was wondering for personal use how you would go about writing a function on a button that when the mouse click is down it would keep firing the function kinda like it does when using the onEnterFrame on key frame..
View 2 Replies
Oct 8, 2008
I think this is a scope issue, but can't be sure. I am using FlashDevelop, Actionscript 2.0 to create my movie. I call the sendAndLoad() function to display data from a database. I also have "Previous" and "Next" buttons to move through different data.
Since I was going to load data in three different locations (Load, Previous, Next) I created a LoadData() function. This function contains the sendAndLoad() to the server.
The initial load works great with the LoadData() function, the first record is displayed correctly. My problem is when I program the onPress for the Previous and Next buttons.
Why does my LoadData() function not run when inside the Previous/Next button onPress events?
example code:
class Main
{
private var parent:MovieClip;
[Code]....
View 2 Replies
Apr 1, 2005
[Code]...
when the movie loads, flash immediately 'getURL' BEFORE i press my button1. how come the code execute even before i press it 1st? what's wrong with my code?
View 6 Replies
Jan 10, 2010
I have created different buttons on different movieclip. Then i assigned onPress event on each buttons. But the function of onPress event is not triggered. The arrangement of movieclips is following.
var mainMC:MovieClip = _root.createEmptyMovieClip("mainMC",0);
mainMC._alpha = 0;
var adImgMC:MovieClip = mainMC.createEmptyMovieClip("adImgMC",0);
var offerMC:MovieClip = mainMC.createEmptyMovieClip("offerMC",1);
var offerList:MovieClip = offerMC.createEmptyMovieClip("offerList",0);
[Code] .....
I have created an event as follows:
offerList.onRollOver = function(){
offerList.stopTween();
clearInterval(autoScrlTimer);
} offerList.onRollOut = function(){
duration = 0;
autoScrlTimer = setInterval(automaticScroll,duration);
ovrFlag = true
}
I doubt that the onPress event is not working because of the above piece of code.
View 4 Replies
Sep 10, 2007
my problem is that my onPress function doesn't want to work. Here�s the script: PHP Code:
[Code]...
the hilite function should let the buttons disable or not, but it just will not work.....
View 1 Replies
Oct 31, 2007
I have a movieClip in which by default it does not have an 'onPress' function applied to it. However, I have a button on the stage that the user can press to 'unlock' that mc, and when they unlock it, it sets a 'locked' variable to false, calls a function which checks the 'locked' status, and if it is false, it that sets the onPress for that movieclip (which makes it draggable)If that button is clicked again, 'locked' is set to true, and that same function is called again, and then the status is recognized as locked...but I need it to somehow remove/delete the 'onPress'function. I know the first thought would be to just set 'enabled' for the mc to false...which I tried at first.... but the problem is that some of the mc's are transparent in the middle, and there can be other items below them...and those items below need to be 'clickable'. Even though the top mc is not enabled, it still recognizes that it has had an 'onPress' function applied to it, and thus won't let anything below it be clicked. (When the movie first launches, the function setting the onPress has not yet been set, and so the items below it are therefore clickable).
I know that might have been a bit confusing, so let me know if you have any questions to further clarify. need to make a movieclip that was clickable (through an onPress function) onClickable, but also treat it like it has never had an onPress applied, so that any items below it can be clicked.
View 2 Replies
Jun 16, 2008
[Code]...
I need to be able to pass variables to my onpress function.
View 10 Replies
Aug 22, 2009
I have some script for a sliding gallery and buttons to move the images. how to change the function from onPress to onRelease so I can animate the button.
this.onEnterFrame = function(){
if(rewind == true && counter > 0){
counter = counter - 1;
[Code]....
View 3 Replies
Jun 17, 2010
I am using the following code to simulate a volume control bar filling on vol+ and unfilling on vol-. The dragger is a mask that causes the fill to appear and disappear when the mouse is pressed and dragged on the volume controller. It works well, but I would like to add a "switch" that moves at the same time and in the same location as the fill, but on top of it... I created the movieClip for the switch and tried all kinds of variations to the following code with its instance in the code, but cant seem to get it working... below is the code which works with just the mask filling / unfilling.
this.ratio = 0;dragger.onPress = function() {this.startDrag(true, 0, 0, line._width, 0);
this.onEnterFrame = function() {
ratio = Math.round(this._x*100/line._width);
_root.volume = ratio; }; };
dragger.onRelease = dragger.onRelease=stopDrag;
View 3 Replies
Mar 7, 2012
I'm trying to make a point and click game for the fun of it. I'm having troubble with the .onPress function. I've made an array of movieclips, and I want to go through them in a loop, and make an onPress function for each of them. What I am trying to do with the code below is to make the debugText tell me what movieclip I pressed:
var letterArray = new Array();
letterArray = [l1_mc, l2_mc, l3_mc, l4_mc, l5_mc, l6_mc, l7_mc, l8_mc, l9_mc,
l10_mc, l11_mc, l12_mc, l13_mc, l14_mc, l15_mc, l16_mc, l17_mc, l18_mc,
l19_mc, l20_mc, l21_mc, l22_mc, l23_mc, l24_mc, l25_mc, l26_mc, l27_mc,
l28_mc, l29_mc, l30_mc, l31_mc, l32_mc, l33_mc, l34_mc, l35_mc, l36_mc];
[Code] .....
DebugText outputs:
Pressed movieclip nr: 36 36 36 36 36 36
No matter what clip i press, i get the same output: 36. why?
View 5 Replies
Mar 4, 2005
I am currently working on the Slider Bars tutorial at [URL]. I got dragger to work, I just want to better understand the dragger.onPress=function() part. With a normal function you have:
function hello(){
trace("hello");
}
Then when I wanted to run the function, I would use:
hello();
Ok so if dragger is pressed (onPress) then it creates a function, right? So how do you run the function? Or is the function running as I'm pressing dragger?
View 3 Replies
Nov 4, 2005
I'm loading pictures from an array, each picture gets his own onPress function[code]...
View 3 Replies
Oct 29, 2006
I am trying to use the code in one of the tutorials which loads a movieclip.I need to load about 10 clips using the method below, but I can only get one to load. I will also need to make each of them draggable.
Code:
but.onPress = function ()
{
_root.createEmptyMovieClip("container", 1);
loadMovie("square.swf", "container");
[code]....
View 3 Replies
Jul 5, 2006
I am creating a gallery type site, I am loading xml data externally creating duplicate movie clips and it all works fine, my only problem is I want them to go to a URL, I have one of the nodes with the URL and in my actionscript I am calling a function to getURL on press, the problem is on each separate movieclip it links to the URL of the last movieclip in the stack.
View 1 Replies
Jun 14, 2006
When I use:
on (release){
this.stop();
getURL("page.html", "_blank");
}
Why is it that when that new page window is loaded the background flash window then runs my
on (rollOut){
this.play();
}
function? I am trying to pause the timeline I am clicking from in Flash. If I take this line out (this.play() it pauses, but if I were to go that way how would I start getting my MC to play again when the user gets back to the flash window?
View 3 Replies
Feb 25, 2009
I wondering if there is a way to cancel a button's onPress action.For example on my button I have the following:
Code:
on (press) {
startDrag(this, false, 384, 2.5, 384, 70.5);
}
[code]....
However if you press the button and roll out with your mouse button still held down it will continue to drag even after you release the mouse button. It then won't stop dragging until you roll over and then out of the button.
To correct this I was wondering if there is a way to call the on(Press) action and stop it OR to activate the on(release) or on(rollOut) actions OR a way to activate "stopDrag();" when the user rolls out even if they are still holding the mouse button down.
View 3 Replies
Mar 9, 2005
I have an image that I put in my movie. I then changed it via "Convert to Symbol" to a button. Within it I have two images, one that is for the up or no mouseover version and the other for the mouseover or down position. This part works fine. However using the code below I click on the button and nothing happens. The mouseover stuff still works fine just not the getURL. This should be so simple but it is holding me up.
Code:
SkipIntro.onPress = function() {
getURL("[URL]", "_blank", "GET");
};
View 2 Replies
Jan 8, 2007
I am trying to build a drop down menu using fuse kit. I somewhat understand the fuse kit, or the stuff I need to alpha, slide, tween and the whatnots. I have a menu button, (button_mc) press it once and the sub menu appears. Press it again and the sub menu disappears But how do I write the code. So It will work?
button_mc.onPress1 = function() {
Some code that make the menu appear
} button_mc.onPress2 = function() {
Some code that make the menu disappear
View 3 Replies
Aug 3, 2007
I have the following structure set up from the top down - one inside the other on the stage. All instance names have been assigned properly[code]...
I've been trying various combinations of this from the main timeline to get a response when I fire the link (card1_button1) but nothing works. This is the longest version with everything in the path[code]...
View 6 Replies
Jan 29, 2009
I have created a buttons with setInterval so that it can call the function till the button will be pressed.onRelease of button I 'm clearing the interval.It is working fine. It gives problem when I'm pressing a button and moving the cursor out of that button area and releasing, it does not call the onRelease event and hence the function goes in the infinite loop.
_level0.main.btn_SizePlus.onPress = function()
{
if(plusint != null)
[code]....
View 2 Replies
Mar 29, 2009
we need to make a variable out of i in order to choose the i of that moment during the loop... [URL]
I made an Actionscript together with PHP script which looks for files in a certain folder:
here is the php script:
[Code]....
View 3 Replies