ActionScript 2.0 :: Listener In Order To Make OnRelease Function Work?
May 20, 2007
Do I have to use a listener in order to make the onRelease function work? Right now it doesn't and I think it's because the png isn't loaded before the onRelease function is invoked.[code]
Ok, a simple situation: say I have five fairly complicated functions on one frame. I define all my functions, what they do, etc. After all that, I call all five functions in a row like
The easiest thing is if you look at my swf: [URL] Ive built a dynamic photo gallery which works from an XML database. The database contains the various gallery titles, the photo image paths and their captions.
The first page of the gallery is a thumbnail index page (lots of small preview images of the photos). The thumbnails load up one by one, they are only 1kb each but there are hundreds so takes some time. If a user clicks on one, the thumbnail movieclip is hidden with (._visible) and the photo page is shown, also with (._visible).
The problem is, the thumbnails are still being loaded in the background, so the chosen photo is not downloaded+shown until all the thumbnails have loaded. What kind of code do I need to place on the thumbnail's "onRelease" function to cancel the parent "make thumbnails" function ive made?
When you are dragging a movieClip on the stage, it generally works fine. But if you are performing some calculation or hitTest while you dragging, the location of the cursor and the movieClip starts to go unsynched. For example, in the following code, I am running an ENTER_FRAME handler while you drag a box, and this onEnterFrame_Box method contains a bogus for loop to slow down the process. The drag & drop works snappy if you comment out that for loop... But if you bump up that 100 to something like 200, Flash Player runs quite slow, and the location of the box won't match where your mouse cursor is...
ActionScript Code: var box:Sprite = new Sprite(); box.graphics.clear(); box.graphics.beginFill(0xCCCCCC, 1); box.graphics.lineStyle(1, 0x999999); box.graphics.drawRect(0, 0, 100, 100); [Code] .....
Lets say that I got movieclips A,B,C,D in my scene and E,F which only come into scene when A hitTest B and C hitTest D.I was able to make the A+B and C+D hitTest functioning properly. But when E,F came into the scene, I tried to make E to hitTest F to get something else function but they won't work.# note that there is some short animation before E & F come into scene.I am pretty sure all the instance names are named properly.
I'm moving on to my next massive programming project and I'm trying to decide whether I should code it in as 2.0 or 3.0. I came across the new click event model in 3.0. Right now it's looking like a pain in the butt to me. So now I have to make a function and add it as an event listener? what the hell? What's the benefit? I understand stuff like this makes AS a more complete language but it's kinda annoying.
Is there a way to make the onMouseDown function also work within the MovieClips area in this code example? It seems like the two functions are conflicting.
I'm using duplicateMovieClip to create instances of a clip. Then I use an array to name the clips. In the scrip that duplicates and names them, I also have an onRelease function to make the mcs do something when you click them. I can't get this onRelease part to work. I need to:[code]
- swap the depths - load some text - attach a movie from the library
I have a mc that you should drag to the right mc.The mc that you have to choose from are sometimes a little close so I made a code that the mc that you drag will xscale so it will be smaller.But then if I press on the end of the mc before dragging the mc is outside the mouse and you cant use the OnRelease code.How to avoid that.Enclose a small fla, and the code is:
function god ( t,t1,t2){ t.onPress = function(){ this._xscale = 20;[code].......
I'm using duplicateMovieClip to create instances of a clip. Then I use an array to name the clips. In the scrip that duplicates and names them, I also have an onRelease function to make the mcs do something when you click them. I can't get this onRelease part to work.
I need to: - swap the depths - load some text - attach a movie from the library
I can't see any errors with my script, so I hope someone can look at it and give me a clue. The part I'm having trouble with is:
I need help with onRelease after using loadMovieClip function. onRelease doesn't work on duplicateMovieClip. The code:function buildGallery (page Position)[code]
I am designing and coding a navigation menu at the moment, and so far I have got the button instances to duplicate for each of the menu items, and set widths, positioning values and RollOver/RollOut functions. However, I would ideally like to include the onRelease button functions in the for loop too - as they are all the same apart from the variable "i". Here is the code snippet:
ActionScript Code: for (i=1;i<(_root.noofmenuitems+1);i++){ duplicateMovieClip("mc", "mc"+i, i);
[code]...
Now my problem is that by the time the onRelease function is called, the for loop has been completed and the value of i returned is the last i value from the loop (_root.noofmenuitems+1). The this["mc"+i] part obviously works, because the trace function is called when I click any of the menu items.The problem is that I have 6 menu items, and when I click any of them, the trace function returns "test 7" - not the corresponding i values for each button.
I need the following script to run as soon the as the play head comes on the frame. Right now it is activated through an onRelease...need to replace that:
myButton_btn.onRelease = function() { tweenBall(mx.transitions.easing.Strong.easeOut); }; function tweenBall(easeType) {
I need the following script to run as soon the as the play head comes on the frame. Right now it is activated through an onRelease...need to replace that:
i have a movieclip on the main timeline, and inside that mc I have 1 button on first frame and 1 button of second frame...From the main timeline i run this script for frame 1 button...
And this works fine.. however, i run the exact same script for the button on frame 2, ofcourse changing the path and gotoAndStop(1) instead... And this isnt working.. The button's over frame works so its activated...
Just getting up to speed on looping and incrementing variables. A real time saver.I have a onRelease function that I would like to apply to several button objects:
I need the p variable as well as the target but1 to increment. This is my first attempt:
for (n=1; n<=23; n++) { phase1a.but[n].onRelease = function() { p=[n+1];[code].......
I get a good trace on n showing that the incrementing is successful but nothing on p when the button is clicked and no execution of the function thisImage(). Not getting any errors either. Can you not loop an onRelease statement?
I am working in CS4, but using as2 as the publish setting since the swf I need to load in was previously done in as2.I have an interface that I am loading a logo.swf into. This logo has animation that works properly both in test and in the browser. There is, however, a function in the logo.swf that is not working.
When I test with the IDE this is clickable within the interface, but when I view via the webpage it is not. AllowScriptAccess was set to sameDomain, but I have also tried that set to always.
I can't get my getURL to work. It works when I use "_blank" but not when I use "_self" or "_parent" or "_top" or leave it empty. I've got it right off the main timeline. I've also tried putting it within an onRelease function.
So, this doesn't work: Code: getURL("images/aboutus.jpg", "_self"); But this does: Code: getURL("images/aboutus.jpg", "_blank");
Strangely enough I can't access the variable i in the onRelease function below. I guess it must have something to do with the position where I declared it. But I also tried to declare it outside of the functions but it didn't work either.. how to solve this problem?
I have the following code that lists 5 buttons with dynamic texts... when pressing each button a popUp_mc window will appear with some content show in dynamic text. Only one of these 5 buttons have some images that will have symbols_mc appear... in this case I just alpha this symbol to 100 only for this button, but for the rest alpha = 0. The button the I want to show the symbol is the third one. I'm a bit confused on how to show this symbol according to the following code below.
I have this function on "mc".And I would like to call the function on ''mc" without clicking on "mc". How can I create the state where this "mc" is being pressed by script on a frame or another button?
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.