ActionScript 2.0 :: OnPress Not Working On Jpg?
Jun 17, 2009the onPress down the bottom of this code wont trace
Code:
thumb_1_mc.onPress = function(){
loadjpg();
}
[Code].....
the onPress down the bottom of this code wont trace
Code:
thumb_1_mc.onPress = function(){
loadjpg();
}
[Code].....
I have created a simple grid on my canvas.First I defined an empty movieclip (wrapper) for my grid, then I draw lines onto it to make the grid.Now, I want to click on the grid and get the x/y of where I clicked so I can determine where in the grid i am. But my trace in the onPress event does not show.I'm under the impression that my mcGrid has a 0x0 width and height. When I trace the mcGrid._width in the bottom it outputs "0" so maybe that's why it is not working? Here is my code:
ActionScript Code:
_root.createEmptyMovieClip("mcGrid", 1);
for (var i=0; i<12; i++) {
var clipName = "mcHorizontal_"+i;
[code]....
I`m working on a presentation template....I`m gettin along ok, with fullscreen, presentation mode etc. However, the classic click and goto next slide aint working so good. yet.I`ve been trying to set som sort of action: onPress.Nextframe but it is not working. Also, I`m trying to create the reverse fx, let`s say when I hold down shift (for example) and then click - the "presentation" should play backwards.
View 4 Replieslets say i have dynamically duplicated movieClips ID's stored in array list. i want to add a onPress event to them. how do i do it?
[Code]...
[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.
Im new to actionscript , but not new to programming..Got the following problem : Im building a flash page dynamically with actionscript , from a php generated xml file which defines image/swf paths, text, position etc..All works well, except, i can't set an onPress function on the movieclips i create. Im doing something like this:
[Code]...
I have a Red Cup which is a MC and I want the Red Cup to go UP when clicked on and goes back down when you release the mouse click.
I know the coding is
On(press) { and
On(release) {
But I do not know the details.
I have a movieclip with onPress and I attach another movie to the first one. Unfortunately, the second movie inherits the onPress function from the first one. How can I remove the onPress function from the second movie? I tried to set it's onPress and onRelease to null and undefined but no success.
View 3 RepliesI'm trying to use some buttons to navigate through an FLV with cue points. Here is an example of the code I'm using so far, but I'm getting an Invail Seek error in my output.
[AS]
photochromic_but.onPress = function() {
FLV_player.seekToNavCuePoint("Photochromic");
};
[/AS]
If I want a button to perform 2 actions such as 1st time onPress the mc visible true and 2nd time onPress the mc visible false and true and false and so on.
View 2 RepliesI have the next code:
mc.onPress=function()
{
//some code
}
How do I remove the event handler onPress?
I have a button that I basically want to give the action:
on (press) {
gotoAndPlay (3) ;
}
[code]....
I'm trying to do something like this:
var something = "someValue";
some_btn.onPress = function (something) {
someFunction(something);
}
[Code].....
But it traces "undefined". What would be the correct way of achieving this?
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());
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 RepliesI have a pair of triangular movieclips that are up against each other real snug and are practically touching. As a result their bounding boxes overlap so using onPress for them causes the one on the higher depth to be clicked. How do I use onPress to mathematically determine if the cursor is within some boundaries I set?
View 1 RepliesIm trying to drag a movieClip onPress.. works ok until i load an image into the movieClip..
Code: Select allimgBig.onPress = function() {
this.startDrag();
}
imgBig.onRelease = function() {
[Code].....
I just have a code attaching mc for create a thumbnail.I can't assign a onPress action..because when I test it ..it's seem not working.at least tell me what's wrong with this code..for load image thumnail part is okay only for assigning onpress action.[code]
View 2 RepliesCode:
function loadSWF(src) {
_parent.swfContainer.loadMovie(src);
}
[Coe]....
the code above ... the onPress button dont work dont know
ok so i have a few complex movie clips and in them is code for onRollOver, onRollOut, nPress, onRelease, bla bla blais there any way to "force" them to act like they are being rolledover or something without the user actually rolling over them?
View 2 RepliesI'm having a problem with my onPress actions when reading them form an XML file. Here's what I'm trying to do: Read xml file: duplicate movie clip according to how many xml items there are. Place a different onPress action to each movie clip according to what the corresponding path is in the xml. My problem is that each time I press any movieclip I always get the last path in the xml file. The loop is over writing the value and when the onPress function is called it uses the last value. How do I get the onPress to remember which movie clip it is and use the appropriate onPress action?
Here is my code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var Portfolio:XML = new XML();
Portfolio.ignoreWhite = true;
Portfolio.onLoad = function(bSuccess:Boolean):Void {
[Code] .....
Ok so options is the array there can be many or one outside swf. we go through the array creating empty movieClip and populating each with an outside swf. Once loaded i want to use these newly created movieClips as buttons.
1. can i declare the onPress in a for loop?
2. how do i centre and space them no matter how many they are the will be linear.
Code:
for (var i:Number = 1 ; i<options.length; i++){
//create a holder
_root.createEmptyMovieClip("optionD"+i,4+i);
[Code]....
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]....
I know almost nothing about actionscriptAnd here is the actionscript for it.
zone11_mc.onRollOver = function ()
{
zone11_exp_mc.gotoAndPlay(2);
[code]......
[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?
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.
I'm trying to make an onPress function for a MC inside a MC and I have figured it will look something like this:
_root.mc1.mc2.onPress = function(){}
It won't work though. What to do? (Now I see, I have that mc2 on the 2nd frame inside mc1... if I put it also on the first frame it works fine, but I don't want it on the first frame).
I have a scrolling navigation bar and two buttons on either side to move it left and right. I created functions to handle moving the navigation MC left and right, and they work just fine.
My problem is, I'm trying to set my buttons up using onPress, like this:
function ScrollForward()
{
// function contents
}
[Code]....
The problem is, when I create the .swf, the functions placed in the onPress events automatically run. And neither button triggers the "onPress" events. I have removed the last two lines with the onPress events and the functions do not run, so the way I've set them up is obviously wrong.
The problem is obviously the onPress lines because the functions do not run without those lines, and if I simply put the full function within the onPress event rather than separate, they both run correctly. I want to call these functions elsewhere, so I don't want to simply include them solely within the onPress event.
I have an MC that has a graphic. I have faked buttons for just the over state, so it shows a border around a portion of the graphic. That works fine until I added this to the MC:
this.onPress = function(){ if (this._currentframe != 1) {
rewind = true;
}}
The onPress function does what it should do, but the buttons no longer show their over state when I hover over them.
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.