Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Where Did OnPress Go?


I need onPress because I'm doing an navBar drag where onPress starts the drag and onRelease stops it. "click" is the equivalent to onRelease right, but I don't see an equivilant for onPress, and capturing and hadling all mouseDown events is definitely not something I want to do.

FlashDocs are almost no help when it comes to AS3 Event types. Description of CLICK: "Defines the value of the type property of a click event object." Oh is THAT what it does.




ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 07-19-2008, 05:05 PM


View Complete Forum Thread with Replies

Sponsored Links:

Onpress But Not Visible Before The Onpress...
I'm gonna try and make this as simple as possible.

I have a button.


What i want to have happen is that when I click on the button, another movie clip appears and does its thing.

What I'm confused about is how to get the movie clip to be on the stage but not be visible until the click. Thanks

View Replies !    View Related
Mc With OnPress Within Another Mc With OnPress - Issue
Hi Guys,

I am wondering if I am going nuts but I have an Mc within another mc.
I would like both of them to ba able to have an onpress event.

here is the code

container.onPress = function(){
trace('contaienr');
}
container.scroller.onPress = function(){
trace('scroller');
}

The scroller movie is smaller than the main movie.

Why when I click on the scroller movie - does it not pick up the trace('scroller');??

Thanks

Mani

View Replies !    View Related
Button OnPress Calls Another Button's OnPress?
I've run into a problem that's driving me crazy. I'd really appreciate it if someone could take a look at this and help me out.

You can see a working example of the file at: http://www.benekdesign.com/ILRE/map.php

Here is the problem:

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();
};
listAbaco_mc.onRollOut = function() {
_root.map_mc.abaco_mc.button_btn.onRollOut();
};
listAbaco_mc.onPress = function() {
_root.map_mc.abaco_mc.button_btn.onPress();
};
And here is the related code from the root that includes the onPress referenced above plus all functions called as a result of that (some areas to note are bolded):


Code:
//++++++++++++++++++++++++++++++++++++++++++++++
// functions
//++++++++++++++++++++++++++++++++++++++++++++++
// function to open/close side menu
openPanel = function (island) {
panel_mc.alphaTo(20, .001, "linear", 1.4, function () {
panel_mc.gotoAndStop(island);
});
panel_mc.xSlideTo(603, .7, "easeOutQuint", 1.5);
panel_mc.alphaTo(100, .7, "easeOutQuad", 1.5);
};
closePanel = function () {
panel_mc.xSlideTo(925, .7, "easeInQuint", 0);
panel_mc.alphaTo(20, .7, "easeInQuad", 0);
};
// function to fade out unselected islands on zoom
fadeIslands = function (alpha, mapPath) {
map_mc.extraIslands_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.abaco_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.acklins_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.andros_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.bimini_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.berry_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.cat_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.crooked_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.eleuthera_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.exuma_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.grand_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.inagua_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.long_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.mayaguana_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.np_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.rumcay_mc.alphaTo(alpha, 1, "linear", .3);
map_mc.sansalvador_mc.alphaTo(alpha, 1, "linear", .3);
if (alpha < 100) {
mapPath.alphaTo(100, 1, "linear", .3);
}
};
// function to fade labels on zoom
fadeLabels = function (alpha, delay) {
map_mc.labels_mc.alphaTo(alpha, .5, "linear", delay);
if (alpha == 100) {
map_mc.labels_mc.abacoLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.acklinsLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.androsLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.biminiLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.berryLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.catLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.crookedLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.eleutheraLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.exumaLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.grandLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.inaguaLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.longLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.mayaguanaLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.nassauLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.npLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.rumcayLabel_mc._alpha = labelAlpha;
map_mc.labels_mc.sansalvadorLabel_mc._alpha = labelAlpha;
}
};
// disable island buttons when zoomed in
disableButtons = function () {
map_mc.abaco_mc.button_btn.enabled = false;
map_mc.acklins_mc.button_btn.enabled = false;
map_mc.andros_mc.button_btn.enabled = false;
map_mc.bimini_mc.button_btn.enabled = false;
map_mc.berry_mc.button_btn.enabled = false;
map_mc.cat_mc.button_btn.enabled = false;
map_mc.crooked_mc.button_btn.enabled = false;
map_mc.eleuthera_mc.button_btn.enabled = false;
map_mc.exuma_mc.button_btn.enabled = false;
map_mc.grand_mc.button_btn.enabled = false;
map_mc.inagua_mc.button_btn.enabled = false;
map_mc.long_mc.button_btn.enabled = false;
map_mc.mayaguana_mc.button_btn.enabled = false;
map_mc.nassau_mc.button_btn.enabled = false;
map_mc.np_mc.button_btn.enabled = false;
map_mc.rumcay_mc.button_btn.enabled = false;
map_mc.sansalvador_mc.button_btn.enabled = false;
};
enableButtons = function () {
map_mc.abaco_mc.button_btn.enabled = true;
map_mc.acklins_mc.button_btn.enabled = true;
map_mc.andros_mc.button_btn.enabled = true;
map_mc.bimini_mc.button_btn.enabled = true;
map_mc.berry_mc.button_btn.enabled = true;
map_mc.cat_mc.button_btn.enabled = true;
map_mc.crooked_mc.button_btn.enabled = true;
map_mc.eleuthera_mc.button_btn.enabled = true;
map_mc.exuma_mc.button_btn.enabled = true;
map_mc.grand_mc.button_btn.enabled = true;
map_mc.inagua_mc.button_btn.enabled = true;
map_mc.long_mc.button_btn.enabled = true;
map_mc.mayaguana_mc.button_btn.enabled = true;
map_mc.nassau_mc.button_btn.enabled = true;
map_mc.np_mc.button_btn.enabled = true;
map_mc.rumcay_mc.button_btn.enabled = true;
map_mc.sansalvador_mc.button_btn.enabled = true;
};
// function to zoom into map
zoomIsland = function (island) {
// set some vars depending on which island to zoom to
switch (island) {
case "abaco" :
_root.accomLink = _root.abaco[0];
_root.direcLink = _root.abaco[1];
_root.activLink = _root.abaco[2];
_root.propLink = _root.abaco[3];
mapX = 650;
mapY = 750;
mapScale = 300;
mapPath = _root.map_mc[island + "_mc"];
break;
case "acklins" :
_root.accomLink = _root.acklins[0];
_root.direcLink = _root.acklins[1];
_root.activLink = _root.acklins[2];
_root.propLink = _root.acklins[3];
mapX = -420;
mapY = -490;
mapScale = 500;
mapPath = _root.map_mc[island + "_mc"];
break;
case "andros" :
_root.accomLink = _root.andros[0];
_root.direcLink = _root.andros[1];
_root.activLink = _root.andros[2];
_root.propLink = _root.andros[3];
mapX = 675;
mapY = 250;
mapScale = 225;
mapPath = _root.map_mc[island + "_mc"];
break;
case "berry" :
_root.accomLink = _root.berry[0];
_root.direcLink = _root.berry[1];
_root.activLink = _root.berry[2];
_root.propLink = _root.berry[3];
mapX = 1235;
mapY = 1025;
mapScale = 700;
mapPath = _root.map_mc[island + "_mc"];
break;
case "bimini" :
_root.accomLink = _root.bimini[0];
_root.direcLink = _root.bimini[1];
_root.activLink = _root.bimini[2];
_root.propLink = _root.bimini[3];
mapX = 2450;
mapY = 1315;
mapScale = 900;
mapPath = _root.map_mc[island + "_mc"];
break;
case "cat" :
_root.accomLink = _root.cat[0];
_root.direcLink = _root.cat[1];
_root.activLink = _root.cat[2];
_root.propLink = _root.cat[3];
mapX = 150;
mapY = 300;
mapScale = 500;
mapPath = _root.map_mc[island + "_mc"];
break;
case "crooked" :
_root.accomLink = _root.crooked[0];
_root.direcLink = _root.crooked[1];
_root.activLink = _root.crooked[2];
_root.propLink = _root.crooked[3];
mapX = -650;
mapY = -620;
mapScale = 700;
mapPath = _root.map_mc[island + "_mc"];
break;
case "eleuthera" :
_root.accomLink = _root.eleuthera[0];
_root.direcLink = _root.eleuthera[1];
_root.activLink = _root.eleuthera[2];
_root.propLink = _root.eleuthera[3];
mapX = 470;
mapY = 470;
mapScale = 350;
mapPath = _root.map_mc[island + "_mc"];
break;
case "exuma" :
_root.accomLink = _root.exuma[0];
_root.direcLink = _root.exuma[1];
_root.activLink = _root.exuma[2];
_root.propLink = _root.exuma[3];
mapX = 400;
mapY = 190;
mapScale = 275;
mapPath = _root.map_mc[island + "_mc"];
break;
case "grand" :
_root.accomLink = _root.grand[0];
_root.direcLink = _root.grand[1];
_root.activLink = _root.grand[2];
_root.propLink = _root.grand[3];
mapX = 1030;
mapY = 1000;
mapScale = 400;
mapPath = _root.map_mc[island + "_mc"];
break;
case "inagua" :
_root.accomLink = _root.inagua[0];
_root.direcLink = _root.inagua[1];
_root.activLink = _root.inagua[2];
_root.propLink = _root.inagua[3];
mapX = -470;
mapY = -750;
mapScale = 400;
mapPath = _root.map_mc[island + "_mc"];
break;
case "long" :
_root.accomLink = _root.long[0];
_root.direcLink = _root.long[1];
_root.activLink = _root.long[2];
_root.propLink = _root.long[3];
mapX = 80;
mapY = -80;
mapScale = 400;
mapPath = _root.map_mc[island + "_mc"];
break;
case "mayaguana" :
_root.accomLink = _root.mayaguana[0];
_root.direcLink = _root.mayaguana[1];
_root.activLink = _root.mayaguana[2];
_root.propLink = _root.mayaguana[3];
mapX = -1320;
mapY = -770;
mapScale = 700;
mapPath = _root.map_mc[island + "_mc"];
break;
case "np" :
_root.accomLink = _root.np[0];
_root.direcLink = _root.np[1];
_root.activLink = _root.np[2];
_root.propLink = _root.np[3];
mapX = 1250;
mapY = 900;
mapScale = 999;
mapPath = _root.map_mc[island + "_mc"];
break;
case "rumcay" :
_root.accomLink = _root.rumcay[0];
_root.direcLink = _root.rumcay[1];
_root.activLink = _root.rumcay[2];
_root.propLink = _root.rumcay[3];
mapX = -580;
mapY = -160;
mapScale = 999;
mapPath = _root.map_mc[island + "_mc"];
break;
case "sansalvador" :
_root.accomLink = _root.sansalvador[0];
_root.direcLink = _root.sansalvador[1];
_root.activLink = _root.sansalvador[2];
_root.propLink = _root.sansalvador[3];
mapX = -850;
mapY = 140;
mapScale = 999;
mapPath = _root.map_mc[island + "_mc"];
break;
default :
//nothing
}
// begin the rest of the function
// hide stuff before zoom
closePanel();
compass_mc.alphaTo(0, .7, "easeOutQuad", 0, function () {
compass_mc._visible = false;
});
bahamas_mc.alphaTo(0, .7, "easeOutQuad", 0, function () {
bahamas_mc._visible = false;
});
introText_mc.alphaTo(0, .7, "easeOutQuad", 0, function () {
introText_mc._visible = false;
});
// move map
map_mc.scaleTo(mapScale, 1, "easeInOutQuad", .3);
map_mc.xSlideTo(mapX, 1, "easeInOutQuad", .3);
map_mc.ySlideTo(mapY, 1, "easeInOutQuad", .3);
// fade islands and labels
fadeIslands(15, mapPath);
fadeLabels(0, 0);
disableButtons();
// re-open panel
openPanel(island);
// show return button
return_mc.back_btn.enabled = true;
return_mc.gotoAndStop(island);
return_mc.alphaTo(100, 1, "easeOutQuad", 2);
// show towns, dots and glow
mapPath.maskDot_mc.ySlideTo(0, 1, "easeOutQuad", 2);
mapPath.land_mc.glowTo(0x084d86, .5, 8, 1, 2, false, false, .5, "easeOutQuad", .5);
};
// function to return to map
returnMap = function () {
// hide stuff for zoom out
closePanel();
fadeIslands(100);
fadeLabels(100, 1.3);
return_mc.back_btn.enabled = false;
return_mc.alphaTo(0, .7, "easeOutQuad", 0);
// move map
map_mc.scaleTo(_root.initialScale, 1, "easeInOutQuad", .3, enableButtons);
map_mc.xSlideTo(_root.initialX, 1, "easeInOutQuad", .3);
map_mc.ySlideTo(_root.initialY, 1, "easeInOutQuad", .3);
// re-open panel and show extras
openPanel("start");
compass_mc._visible = true;
bahamas_mc._visible = true;
introText_mc._visible = true;
compass_mc._alpha = 0;
bahamas_mc._alpha = 0;
introText_mc._alpha = 0;
compass_mc.alphaTo(100, 1, "easeOutQuad", 1.5);
bahamas_mc.alphaTo(100, 1, "easeOutQuad", 1.8);
introText_mc.alphaTo(100, 1, "easeOutQuad", 2.1);
// hide towns, dots and glow
mapPath.maskDot_mc.ySlideTo(-150, .7, "easeOutQuad", 0);
mapPath.land_mc.glowTo(0x084d86, 0, 3, 0, 2, false, false, 2, "easeOutQuad", .3);
};
//++++++++++++++++++++++++++++++++++++++++++++++
// fade in on start
//++++++++++++++++++++++++++++++++++++++++++++++
water_mc.alphaTo(100, 1, "easeOutQuad", 0);
compass_mc.alphaTo(100, 1, "easeOutQuad", .5);
bahamas_mc.alphaTo(100, 1, "easeOutQuad", .8);
introText_mc.alphaTo(100, 1, "easeOutQuad", 1.1);
map_mc.alphaTo(100, 2, "easeOutQuad", 1);
openPanel("start");
//++++++++++++++++++++++++++++++++++++++++++++++
// check for querystring and load island
//++++++++++++++++++++++++++++++++++++++++++++++
this.onEnterFrame = function() {
if (_root.startIsland != "" && _root.startIsland != undefined && _root.startIsland != "map") {
map_mc[_root.startIsland + "_mc"].button_btn.onPress();
}
delete this.onEnterFrame;
};
//++++++++++++++++++++++++++++++++++++++++++++++
// island buttons
//++++++++++++++++++++++++++++++++++++++++++++++
// abaco
map_mc.abaco_mc.button_btn.onRollOver = function() {
this._parent.land_mc.shape_mc.colorTo(0xffffff, .3, "easeOutQuad", 0);
this._parent.land_mc.glowTo(0x084d86, 1, 3, 1, 2, false, false, .3, "easeOutQuad", 0);
this._parent._parent.labels_mc.abacoLabel_mc.alphaTo(100, .3, "easeOutQuad");
panel_mc.listAbaco_mc.colorTo(0x000000, .3, "easeOutQuad", 0);
panel_mc.leaf2_mc.alphaTo(100, .3, "easeOutQuad", .2);
panel_mc.leaf2_mc.ySlideTo(panel_mc.listAbaco_mc._y, .3, "easeOutQuad", 0);
};
map_mc.abaco_mc.button_btn.onRollOut = function() {
this._parent.land_mc.shape_mc.colorTo(0xd8eefb, .3, "easeOutQuad", 0);
this._parent.land_mc.glowTo(0x084d86, 1, 5, 0, 2, false, false, .3, "easeOutQuad", 0);
this._parent._parent.labels_mc.abacoLabel_mc.alphaTo(labelAlpha, .3, "easeOutQuad");
panel_mc.listAbaco_mc.colorTo(0x0d4a88, .3, "easeOutQuad", 0);
panel_mc.leaf2_mc.alphaTo(0, .3, "easeOutQuad", .2);
};
map_mc.abaco_mc.button_btn.onPress = function() {
zoomIsland("abaco");
this._parent.land_mc.shape_mc.colorTo(0xd8eefb, .3, "easeOutQuad", 0);
};
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.

I'm pulling out my hair on this one and I'd really appreciate some guidance. This project is nearly done except for this one setback.

Thanks kindly in advance for help.
Cheers,
Benek

View Replies !    View Related
OnPress
hi all,

my problem is that i don't catch the onPress event on a button.

I have a movie clip which contains an instance of a button.
The ActionScript's code of the button instace is :
on(press) {
trace("onPress called");
}
but it makes nothing when clicking on the button.

If i put this code :
this.onPress = function() {
trace("onPress called");
}
the compilator tells me an error :
"Statement must appear within on handler"

2 things :
- i don't have really understand the difference between on(press) an onPress...
- how can i catch the 'click on my button' event

thanks in advance,
pandareum

View Replies !    View Related
Help With Onpress
this.onRelease = function() {
_parent.gotoAndStop("mx", 1);
};



this should work to onpress goto a certain frame

View Replies !    View Related
Help Please With Onpress
how would i make it so onpress of a mc it goes to another scene




home.graffiti.net/fite_club/menu

View Replies !    View Related
OnPress
hey, im not a big actionscripter but here is what im tryn to do.

im tryn to jump from frame 1 to frame 2 on my scene when a button being pressed or released. im not able to do this!!
in the button editing i cant use any actions at all. but then in the sence the onPress function just wouldnt execute. how do i know??


Code:

stop();
a = 0;
StartMenuButton.onPress = function() {
a = 1;
};
i've made a layer with both a keyframe on frame 1 and a keyframe on frame 2 and created a text box wich shows me the value of a. its always stays on 0.

i just want the scene togo to frame x from the current frame if a button been pressed. how do i do that??

thnx for ur time.

-X-

View Replies !    View Related
Using .onPress
i am having trouble using the onPress function in my project.

// the following is just a snippet of my code but i think it is the most important part; it works perfectly in it one by one i load the jpegs into movieclips embeded in other movieClips

if (cycle<=_parent.info.total) {
this.createEmptyMovieClip("newClip"+cycle, cycle+1);// i then create a second movieClip within the first to load a jpeg into
this["newClip"+cycle].createEmptyMovieClip("inner_newClip"+cycle, 1);
location = 'http://turnoffthe.tv/experimental/directorytest/images/'+_parent.info['image'+cycle];
this["newClip"+cycle]["inner_newClip"+cycle].loadMovie(location);
this["newClip"+cycle].attachMovie("frame", "frame"+cycle, 10);// the 'frame' movie clip sits above the jpeg and is attached to the outer mvClip
cycle++
}

// it is with the following code that i am having problems
for (n=0; n<_parent.info.total; n++) {
this["newClip"+n].onPress = function() {
_parent.textbox += n+" is ok";
};
}
//for some reason the textbox, regardless of which image i press returns either ' 1 is ok' or '15 is ok' (_parent.info.total =15)
everything works except the .onPress = function I am at a total loss as to what it could be. Is it that
the onPress is just tempramental and i can't use it whilst targeting movieClips , or is it faulty code.
any input would be appreciated

View Replies !    View Related
OnPress, Please Help
Does anyone know of a way to change the time-interval of the onPress function? By default you have to hold the mouse button down for a certain amount of time before it trggers the event.. any prototype solution?

Any advice, please!

View Replies !    View Related
[F8] OnPress Help
I have a button that when pressed should take me to another page on my website.
The current actionscript code i have is:
forum.onPress = function(){
getURL("forum.htm");
};

But i keep getting "Statement must appear within on handler error messages"
Please help

Chris

View Replies !    View Related
OnPress Q
AS2

I cant understand what I am doing wrong. No matter what I do, I cannot get
teh onPress ot work. Thoughts?:


dealer = this.getLogoInfo();

trace(dealer['photo']+" -> "+dealer['link']);

this.logo_next.onPress = function(){
trace("click");
getURL(_parent.dealer['link']);
}

loadMovie(this.folder_photos+"/"+dealer['photo'],this.logo_next);

View Replies !    View Related
OnPress And While
Code:
loadText = new LoadVars();
loadText.load("data.php?"+random(999));

loadText.onLoad = function() {

i=0;
while(i<30) {
_root.movieclip["b"+i].onPress = function() {
_parent.blacktext.text = loadText["datas"+i];
}
i++;
}

}
This code basically takes varaibales from php page that outputs this


Code:

&datas0=test&datas1=testtest
........ all the way to ..&datas29=testtesttest
anyways this doesnt work... doesnt anyone know why? when i click the button in flash i want the corresponding datas ( data ) to show up.. in blacktext.text

please help..

i hope that makes sense

View Replies !    View Related
OnPress?
hi i'm looking for help ,
i wont laod some jpg to my project and after load i wont that user could click on them (jpg) and when he do this they make bigger
i do some thing like this:

_root.createEmptyMovieClip("jpg_mc",1);
with(jpg_mc)
{
loadMovie("picture1.jpg");
_xscale=10;
_yscale=10;
_x=100;
_y=100;

onPress=function()
{
trace("working"); //but this doesn't work! Why?
}
}



and ofcourse i have more pictures and i wont to load them dynamicle
so:

for(i=1;i<12;i++)
{
_root.createEmptyMovieClip("jpg_mc",1);


_root["jpg_mc"+i].loadMovie("picture"+i+".jpg");
_root["jpg_mc"+i]._xscale=10;
_root["jpg_mc"+i]._yscale=10;
_root["jpg_mc"+i]._x=15+i*5;
_root["jpg_mc"+i]._y=100;
_root["jpg_mc"+i].onPress=function()
{
trace("working"); //but this doesn't work! Why?
}
}

View Replies !    View Related
OnPress And While
Code:
loadText = new LoadVars();
loadText.load("data.php?"+random(999));

loadText.onLoad = function() {

i=0;
while(i<30) {
_root.movieclip["b"+i].onPress = function() {
_parent.blacktext.text = loadText["datas"+i];
}
i++;
}

}
This code basically takes varaibales from php page that outputs this


Code:

&datas0=test&datas1=testtest
........ all the way to ..&datas29=testtesttest
anyways this doesnt work... doesnt anyone know why? when i click the button in flash i want the corresponding datas ( data ) to show up.. in blacktext.text

please help..

i hope that makes sense

View Replies !    View Related
OnPress?
hi i'm looking for help ,
i wont laod some jpg to my project and after load i wont that user could click on them (jpg) and when he do this they make bigger
i do some thing like this:

_root.createEmptyMovieClip("jpg_mc",1);
with(jpg_mc)
{
loadMovie("picture1.jpg");
_xscale=10;
_yscale=10;
_x=100;
_y=100;

onPress=function()
{
trace("working"); //but this doesn't work! Why?
}
}



and ofcourse i have more pictures and i wont to load them dynamicle
so:

for(i=1;i<12;i++)
{
_root.createEmptyMovieClip("jpg_mc",1);


_root["jpg_mc"+i].loadMovie("picture"+i+".jpg");
_root["jpg_mc"+i]._xscale=10;
_root["jpg_mc"+i]._yscale=10;
_root["jpg_mc"+i]._x=15+i*5;
_root["jpg_mc"+i]._y=100;
_root["jpg_mc"+i].onPress=function()
{
trace("working"); //but this doesn't work! Why?
}
}

View Replies !    View Related
OnPress Function
I am trying to place all my code in my action layer in my main movie. Normally I spread my code around in the different buttons and mc's, but I want to change this habit. Anywho, I want to click a mc(xxx) that is inside another mc (morphMain), and have "hi" pop-up when I test the movie. What is wrong with this code (it doesn't work)?

_root.morphMain.xxx.onPress = function() {
trace(hi);
};

Thanks,
gamist

View Replies !    View Related
Problem With OnPress
I have the following (I am kind of new, so be patient) . . .

//establishes _X position
xspot=100;

//places three images side by side
for (i=1; i<4; i++) {
_root.createEmptyMovieClip("mcPix"+i, 100+i);
xspot=xspot+100;
this["mcPix"+i]._x = xspot
loadMovie("small/image"+i+".jpg", "mcPix"+i);

//This is the part I have questions about. I want to be able
//to click on one of the above pictures to pop up the bigger picture
this["mcPix"+i].onPress=function(){
_root.createEmptyMovieClip("mcbigPix"+i, 200+i);
loadMovie("big/image"+i+".jpg", "_root.mcBigPix"+i);
}
}

View Replies !    View Related
Assigning MC.onPress
I'm trying to assign MovieClips.onPress dynamically with a loadMovie function, but can't get it to work.

Here is my script below.
Xml is something like this:
<sectionNode>
<navPageNode urlFile="1stPage">Blah</navPageNode>
<navPageNode urlFile="2ndPage">Blah2</navPageNode>
<navPageNode urlFile="3rdPage">Blah3</navPageNode>
</sectionNode>

for (var z=0;z<numNavPages;z++)
{
var navPageNode = sectionNode.childNodes[z];
var urlAttrib = navPageNode.attributes.urlFile + ".swf";
eval("_root.tMC"+z).onPress = function()
{
_root.loadMovie(urlAttrib);
}

}
what happens here is that all the movieClips.onPress gets assigned "3rdPage.swf"

thanks.

View Replies !    View Related
2 OnPress Functions @ Ones
Hi,

I know sounds a bit funny but is there any way to use more than one onPress function or other functions for a movieClip at ones ?
something like this

onClipEvent (enterFrame) {
this.onPress = function() {
trace("1111");
};
this.onPress = function() {
trace("2222");
};
}

/// Output: 2222

View Replies !    View Related
Problem With OnPress
Why does the onPress doesn't work here. How can i solve this problem.
thx for your help. greetings

code: for (j=0; j<rest; j++) {
_tl.attachMovie("thumb_mc", "thumb"+g, g+100);
d = eval("_tl.varReceiver.thumb"+g);
_tl["thumb"+g].loadMovie(d);
_tl["thumb"+g].onPress = function(){
trace("clicked");
}
_tl["thumb"+g]._x = x;
_tl["thumb"+g]._y = y;
g++;
x += 50;
}

View Replies !    View Related
OnPress = Function() {
Hi,

My code looks like this:

this.square9_mc.onPress = function() {
_root.attachMovie("quad_1", "quad_1_mc", 1);
_root.quad_1_mc._x = 0;
_root.quad_1_mc._y = 0;
};

The problem is that I have a button inside this mc(square9_mc) that controls rollOver effects (and rollOut). Now that I have his code(shown above), the code on the button inside the mc doesn't work.

Is there any way around this??

Thanks
Chris

View Replies !    View Related
OnPress Troubles
i have a FOR loop, and in it there's this-

Code:
mc[i].onPress = function(){
trace(i)
}

but it can not get the value of "i" whatever i do. I've seen there has been this same problem on this forum before.

View Replies !    View Related
OnPress Vs. OnMouseDown
Hi there,
I have a question about the difference between these event handlers. I have tried two different ways. The first way is copied pretty much straight from the Macromedia livedocs page on hitTest(). The second way (the way I tried to do things initially) doesn't work.

Would somebody be able to figure out why the second way doesn't work. I'm not sure that I understand.

I'm using MX 2004 Professional and the movie clip I want to move is a simple clip that contains a single dynamic text field.

First way - this works
code:
currentMovie.word3_mc.onPress = function() {
this.startDrag(false);
updateAfterEvent();
};
currentMovie.word3_mc.onRelease = function() {
this.stopDrag();
};


Second way - this doesn't work
code:
currentMovie.word3_mc.onMouseDown = currentMovie.word3_mc.startDrag();
currentMovie.word3_mc.onMouseUp = currentMovie.word3_mc.stopDrag();

View Replies !    View Related
Button OnPress
im using Flash MX 2004.

i need a movie clip (instance name: brackets01), which has a stop action on the 1st frame, to go to frame 2 when a button (instance name: heartbutton01) is pressed.

both the movie clip and button are on the main stage.

how would this be coded, and where exactly would the code go, in the button, or can it be placed on a main stage frame?

thanks

View Replies !    View Related
OnPress Question
HI,

I'm trying to do something very easy...have an action that jumps to frame 2 when you click on an instance of a movieclip that is within a movieclip. Here is the code I have now:

white_mc.onPress=function(){
gotoAndStop(2);
}

View Replies !    View Related
.onPress In A For-loop OH MY
okay guys.. I need your help

how can you apply an .onPress function to several movieclips? A For-Loop right?

something like this:

for (i=0; i<myArray.length; i++) {
thumb = this.attachMovie("thumb", "thumb"+i, i)

thumb.onPress = function () {
myClipHolder.loadMovie(myArray[i]); //loads image myClipHolder
}
}

BUT THIS DOESN'T WORK... the .onPress function asks what "i" is when the event occurs.. not when the function is assigned to 'thumb' when is what I want. How can I write one function with a dynamic variable and have it apply to several different 'thumbnails'?

View Replies !    View Related
OnPress = Function HELP
Here's my situation:
I have a radio with forward, back, play (radio_play.radio_play_button), and stop buttons. On the radio I have a movieclip called "channel" to display which channel you are on and play the corresponding music on that channel. When you press the forward button, my movie advances to the next keyframe with these actions:

stop();
channel.gotoAndPlay("2");
radio_play.radio_play_button.onPress = function() {
channel.gotoAndPlay("2");
};

In the "channel" movieclip, on frame "2", I have a "loadSound" action. So what I want it to do is: when you press forward, it automatically plays the next song. Then if you hit stop and play again, it will play the same song. The problem is, after stopping the sound, and pressing "radio_play.radio_play_button" to play it again, it goes to frame "3" in "channel" instead of playing frame "2" again.

What am I doing wrong??? This might be confusing to anyone who reads it, so I attached the .fla.
Thanks in advance!

View Replies !    View Related
CreateEmptyMovieClip - OnPress
Hi, I'm trying to create empty clips within a for loop which is no problem but I can't seem to assign an onPress handler to each clip. It works fine without a for loop as below:


Code:
this.createEmptyMovieClip("gradient_mc", 1);
with (gradient_mc) {
colors = [0xFF0000, 0x0000FF];
alphas = [100, 100];
ratios = [0, 0xFF];
matrix = {matrixType:"box", x:100, y:100, w:200, h:200, r:(45/180)*Math.PI};
beginGradientFill("linear", colors, alphas, ratios, matrix);
moveTo(100, 100);
lineTo(100, 300);
lineTo(300, 300);
lineTo(300, 100);
lineTo(100, 100);
endFill();

gradient_mc.onPress=function(){
trace("yey")
}

but when I put this in a for loop it doen't work:

Code:
for(i=1;i<2;++i){
this.createEmptyMovieClip("gradient_mc"+i, 1);
with ("gradient_mc"+i) {
colors = [0xFF0000, 0x0000FF];
alphas = [100, 100];
ratios = [0, 0xFF];
matrix = {matrixType:"box", x:100, y:100, w:200, h:200, r:(45/180)*Math.PI};
beginGradientFill("linear", colors, alphas, ratios, matrix);
moveTo(100, 100);
lineTo(100, 300);
lineTo(300, 300);
lineTo(300, 100);
lineTo(100, 100);
endFill();
}
}
gradient_mc1.onPress=function(){
trace("yey")
}


Can anyone help me out? I'm sure it's something simple...

View Replies !    View Related
OnPress Hand
I have a Movie clip mc
an I put this as:

mc.onPress=function()
{
//............. some action
}


And now my problem! If I click on the _root (outsite mc) to cancel de mc.onPress function . with other words to disappear the hand when I'm over mc.

View Replies !    View Related
OnPress & DuplicateMovieClip
On "layer 1" I have a button with the following code.


button1.onPress = function() {
duplicateMovieClip(_root.Circle_mov,"test1",2);
setProperty ("test1", _x, random(275));
setProperty ("test1", _y, random(275));

trace ("here I am");
};

In my libary I have a movieclip called "circle_mov"
I am expecting that when I click on the button an instance of "circle_mov" is created on layer 1. This does not happen.

Any clue as to why this does not work.

thanks in advance.

View Replies !    View Related
OnPress Within Function
Hey.. haven't found an answer for this yet. My question is this:
I have 10 buttons (named e.g. news_btn, bibliography_btn, photos_btn...).
They practically have to do the same thing, that is gotoAndStop somewhere. But I have to be able to specify a different frame for each button.

I don't want to write the same code for alle the buttons, so my question is, whether or not I can use the OnPress within a function.. something like this:


Code:
function MyFunction(ButtonName, FrameNumber)
{
ButtonName.onPress = function()
{
gotoAndStop(FrameNumber);
}
}

MyFunction(news_btn, 2);


This is precise what I want, but it desn't work... why?

- Rune

View Replies !    View Related
Why Wont It OnPress Here?
Hey... I have this code:


Code:
// Viser billederne
function showPictures(c)
{
// Reset counts
picContainer.removeMovieClip();
albumsMade = 0;
posChecker = 0;
// make large MC picContainer
var Positioner:MovieClip;
Positioner = createEmptyMovieClip("picContainer", getNextHighestDepth());
// set position
Positioner._x = 400;
Positioner._y = 31;
// Loop, sort by chosen category and make picHolders
for (i=0; i < picReceiver["n"]; i++)
{
if (picReceiver["album"+i] == c)
{
insideP = Positioner.createEmptyMovieClip("picHolder"+i, i);
picLoader.loadClip("billedgalleri/small/" + picReceiver["navn"+i], insideP);
albumsMade++;

// This doesn't work :-(
insideP.onPress = function()
{
trace("hello sir");
}
}
}
}

Everything works fine but the onpress :-( I taking names of pictures from a database, loading them into a loadVars and then creating a holder (picContainer) and a movieclip inside this pr. image (picHolder1,2,3.....). But why won't the onPress work? This is as simple as I can do it, and if I trace the variable "insideP" it contains the right path. Even if I type the path myself, it won't work. I can make it work for the larger picContainer Clip, but not for the ones inside of it.

View Replies !    View Related
[F8] Random OnPress
Two things.

1. I want on a mc.onPress to make four mc´s be put on the random places on the scene. But I want to specify the max and min-area. I tried several ways but I didn´t find the right way since the mc jumps on places I don´t want.
2. I made a function that I could use on several mc at the same time. But it´s only the last call ( ruta 1 ) that is randomly places. The others are stuck. How come?

Here is the code:

------
var limitX = Math.floor(Math.random() * 450 + 100);
var limitY = Math.floor(Math.random() * 200 + 100);
function startID ( bild ){
knapp.onPress = function(){
bild._x = random(limitX);
bild._y = random(limitY);
}
}
//
startID ( _root.ruta1);
startID ( _root.ruta2);
startID ( _root.ruta3);
startID ( _root.ruta4);

View Replies !    View Related
[CS3] EnterFrame To OnPress
Please send help.

I've been working on a project for a few weeks and have hit a snag. I would really appreciate it if anyone can direct me in the right direction.

I have action script that allows the user to move through 36 images of one object making the object appear to center rotate on stage. Each image is the object turned 10 degrees clockwise. The action starts as the cursor enters the frame.

My client wants the user to have more control. That is, they want the action to start on a mouseDown. I am at a loss as to how to handle this.

I have the following code attached to an mc. This mc is inside another mc.


Code:
onClipEvent (enterFrame) {
framePos = int(_xmouse / 100 * _parent._totalframes);
if (framePos < 0) {
_parent.gotoAndStop(1 - ((framePos + 1) % _parent._totalframes));
} else {
_parent.gotoAndStop(_parent._totalframes - (framePos % _parent._totalframes));
}
}

I will accept responses directly to my email if needed. This project hinges on this one factor, so I am really open to any and all suggestions.

Thanks!

Arnolfo

View Replies !    View Related
OnPress Repeated?
I've made a flash player that relies on the timeline using embedded flvs, and there are fastforward and rewind buttons. As of now, clicking it skips ahead or behind about 75 frames. I would like it so when you hold the button, it skips repeatedly until it is released, is there a simple way to do this, or will I have to use a listener etc?

Thanks

View Replies !    View Related
AttachMovie From OnPress
hey im trying to load a movie from the library onPress from a button, problem is when i include the x and y in the movieclip, it turn the mc into a button aswell. can you have a look at this for me and tell me what im doing wrong.

butt = button (obviously)
BOXlink = linkage

butt.onPress = function():Void {
this.attachMovie("BOXlink", "box", Box1, 2);
this.box._x = -200;
this.box._x = -200;
}

any help would be great,

thanks.

jarrod

View Replies !    View Related
Assign OnPress To MC?
I have an animation that is inside a MC, it is a 30 frame animation with script to either play when rolled over, or go to frame 15 and play to the end on roll off. so it animates when you roll over it and the reverse animates when you roll off.

This animation works fine, but when I add an onPress event to the Parent MC, the animation breaks. I can still click on the graphic inside the animation and the naviagtion works.. but i'd like to get the animation working again.

When I remove the onPress from the Parent MC the animation inside it works again.

any pointers?

View Replies !    View Related
Onpress Issues
Hey All,

Okay, I've been searching the forums for a while now, and couldn't find anything that seemed to do the trick.

Heres my Code:
[php]
var saveXThumb=0;
for(var i=1;i<4;i++){
var thumbHolder=containerTop.createEmptyMovieClip("thu mb"+i,containerTop.getNextHighestDepth());
thumbHolder.loadMovie("ssth_c"+i+".jpg");
thumbHolder._x=_root.saveXThumb+50;
_root.saveXThumb=thumbHolder._x;
thumbHolder.onPress = function () {
trace("TEST"+i);
}
}
[/code]

the containerTop movie clip is created above this code.

Now, this creates a dynamic movie clip and the thumbnail pick within it. I want it to do a function when that movie clip is clicked. I'm not sure why but the above does not work.

ANY help is greatly appreciated!

View Replies !    View Related
What's Wrong With This OnPress
Hi i am currently creating a number of movieclips and for some reason i cant get this to trace when i roll over any of the 30 dynamically created clips. I just cant see what im doing wrong? any ideas anyone?



Code:
_root.imagearea.duplicateMovieClip("blank_mc"+i, 200+i);
newmovieclip = "blank_mc"+i;
loadMovie(imagearray[i], newmovieclip);
_root[newmovieclip]._x = _root.randomRangeInteger(0, Stage.width);
_root[newmovieclip]._y = _root.randomRangeInteger(0, Stage.height);
_root[newmovieclip].onPress = function () {
trace("hello");
}
cheers Al

View Replies !    View Related
MC Button OnPress Help
I have created a button that plays an animation on the mouse click. I have used the following code:

normalButton_mc.onPress = function () {
this.gotoAndPlay(3);
}

It all works fine, except for when I move the mouse curser away from the target area - the animation stops (it plays til the end if the cursor is over the button)

How can I get the animation to play through, even if I have moved the mouse cursor away??

As you can probably tell, I am very new to this..... so would greatly appreciate any help. Thanks

View Replies !    View Related
OnPress & OnRelease
I have some movieclips that i want to utilize as buttons. These clips are inside another mc.. so I tried using the onPress function.


ActionScript Code:
this.onEnterFrame = function () {
_root.buttons_mc.graphics_mc.onPress = function () {
        trace(ok);
    }
_root.buttons_mc.photos_mc.onPress = function () {
        trace(ok);
    }
_root.buttons_mc.animations_mc.onPress = function () {
        trace(ok);
    }
_root.buttons_mc.forums_mc.onPress = function () {
        trace(ok);
    }
_root.buttons_mc.contactus_mc.onPress = function () {
        trace(ok);
    }
_root.buttons_mc.webdesign_mc.onPress = function () {
        trace(ok);
    }
}
stop();

I placed this in the AS layer of the main timeline..... when I click the mcs however it wouldn't complete the function.

What am I doing wrong...this is the first time i have tried to make mcs work like buttons...

Thanks

View Replies !    View Related
OnPress Trouble
Hi

I want to make my Movie_clip work as a button so when I press the object with my mouse it should jump to another frame. The thing is that it does everything except jumping to another frame:


this.onPress = function()
{
gotoAndStop(2); //this doesn't work
ang++;//this work
trace(2);//this work
}


Is there something I have missed?

Björn

View Replies !    View Related
Help With OnPress Function
In the following code, I am trying to get this._name to do the same as this.tf.text. The tf.text can be anything from my array(not shown) but no matter what the text is, it's always going to be btn_0 and it will always go to the frame label "prod1".

When I comment out the this.tf.text and use the this.name, the on press function doesn't work.


ActionScript Code:
//creates new array "myMenuClips"
            myMenuClips = [];
            for (var i = 0; i<labels_array.length; i++) {
                //trace("labels1_array.length " + labels1_array.length) 
                //when using the attachMovie property in more than one place in
                //a project, besure to place the depth property "j+1000"
                var but = _root.attachMovie("btnMC", "btn_"+i, i+1000);
                //trace("btnMA " + buf)
                myMenuClips.push(but);
                //postion movie clip on stage
                but._x = 614;
                //but._y = 200;
                //_root["btn_"+i]._y = 200
                but.tf.text = labels_array[i];
                //trace("buf tfs text" + buf.tfs.text)
                // change this line for verttical placment
                but._y = 83+_root["btn_"+i]._height*i;
                but.num = i;
// these are the button actions
                but.onPress = function() {
                    trace(but.getDepth())
                    trace(but.tf.text)         
                    trace("name of Movie "+this._name);
                    trace("name of button "+this.tf.text);
                    /////////////////////////////////////////////////////////////////////////////
                    if (this.tf.text == "Bushing Technology") {      
                    //if (this._name = btn_0) {
                        stopAllSounds();
                        for (var i in _root) {
                            if (typeof (_root[i]) == "movieclip") {
                                var isMenu = false;
                                for (var c in myMenuClips) {
                                    if (myMenuClips[c] == _root[i]) {
                                        isMenu = true;
                                    }
                                }
                                if (!isMenu) {
                                    _root[i].removeMovieClip();
                                }
                            }
                        }                  
                        _root.gotoAndPlay("Prod1");      
                    }

View Replies !    View Related
Trigger OnPress()?
OK, I have a xml menu that has an onPress() within it. I also have a variable getting sent into the swf that gives the current pageID via a Request.Querystring.

This menu is a 2 level deep sort of thing, so some parent menu items contain children. I want to be able to trigger my onPress() with code rather than having to actually press the parent item again if the pageID is a parent with children.... hope that makes sense.

The onPress basically contains everything BUT the getURL(), so it expands the menu onPress.

Is there a way for me to say::

Code:
IF ( pageID is a parent with children) then
getURL(pageurl, '_self')

else if(PageID is a child then don't getURL on its parent)
//so just expand the parent.. don't go there
parent.onPress()

Hope that makes some sort of sense....?!

Thanks All!

View Replies !    View Related
OnPress Function ?
Lets say I have a menu with 9 buttons, a movieclip in the library with a dynamic text field with an instance name of "tf". The text of each of these buttons is supplied dynamically from a txt file. When I enter my frame I attach the movieclip and create the buttons dynamically populating each with the text from the txt file.

If I click on any on the buttons I can trace the text of that button by doing this:

ActionScript Code:
trace(this.tf.text)

Now I assign onRollOver, onRollOut and onPress functions. When I rollover the button I change the text color to "black", when I rollout I set the text color back to it's orignal starting color "gray". When I press the button, I set the text color to "blue". If I rollout the color of the text of that button will go back to the starting color. But I don't want the color of the text to go back to the starting color until I press on another button. How can I do that?

I tried to assign some variables to keep track of what I am doing but I haven't been able to find a solution.

Now I have put part of my code here, it's a bit lengthy

ActionScript Code:
function info(myTxt) {
    MyLoadVars = new LoadVars();
    MyLoadVars.load("CdTypes/"+myTxt+"CAMPAIGN.txt", "RS");
    MyLoadVars.onLoad = function(success) {
        if (success) {
            /////  SET UP ARRAY ///////////   
            name0 = this.TeamMembersOn0;
            name1 = this.TestimonialsOn0;
            name2 = this.PortfoliosOn0;
            name3 = this.acquisitionOn0;
            name4 = this.lifeOn0;
            name5 = this.investorsOn0;
            name6 = this.DocumentsOn0;
            //////////////////////// LOAD MENU NAMES and OPTIONS ///////////////////////////////       
            var labels_array = new Array();
            labels_array.push("ABOUT US");
            ///////////////////////////////////////////////////////////////
            if (this.TeamMembersOn0 == 0) {
            } else {
                labels_array.push("MEET YOUR TEAM");
            }
            /////////////////////////////////////////////////////////////////////////////////   
            labels_array.push("REFERENCES");
            ////////////////////////////////////////////////////////////////////////////////
            if (this.TestimonialsOn0 == 0) {
            } else {
                labels_array.push("TESTIMONIALS");
            }
            //////////////////////////////////////////////////////////////////////////////////   
            if (this.PortfoliosOn0 == 0) {
            } else {
                labels_array.push("PORTFOLIO COMPANIES");
            }
            ///////////////////////////////////////////////////////////////////////////////////////  
            if (this.acquisitionOn0 == 0) {
            } else {
                labels_array.push("ACQUISITION PROCESS");
            }
            /////////////////////////////////////////////////////////////////         
            if (this.lifeOn0 == 0) {
            } else {
                labels_array.push("LIFE WITH RIVERSIDE");
            }
            /////////////////////////////////////////////////////////////////      
            if (this.investorsOn0 == 0) {
            } else {
                labels_array.push("INVESTORS");
            }
            //////////////////////////////////////////////////////////////////////////////////////   
            if (this.DocumentsOn0 == 0) {
            } else {
                labels_array.push("ADDITIONAL INFORMATION");
            }
            ///////////////////////////////////////////////////////////////////
            labels_array.push("CONCLUSION");
            ///////////////////////////////////////////////////////////////////////   
            // loops for each item found in "labels_array", attaches "btnMC" from the library,
            // populates "tf" with the values
            // creates new array "myMenuClips"
            myMenuClips = [];
            // "remember last Xpos"
            lastXPos = 0;
            // the space between 2 elements
            mySpaceVar = 5;
            for (var i = 0; i<labels_array.length; i++) {
                var but = _root.attachMovie("btnMC", "btn_"+i, i);
                myMenuClips.push(but);
                but._y = 582;
                but.tf.text = labels_array[i];
                but.tf.autoSize = true;
                // lastXPos is the left border of the element                     
                but._x = lastXPos;
                //trace(but._x)
                // so do.....for the next left border
                lastXPos = lastXPos+but._width+mySpaceVar;
                //trace(lastXPos+but._width+mySpaceVar)
                but.num = i;
            }
            // if the user selects "x" menu items we need
            // to position the menu in the center of the stage
            // take 800 (or stage width) minus total width of the menu and divide by two
            // this is now the newXPos
            // trace (800-(but._x+but._width))/2   
            //trace(but._x+but._width)
            newXPos = (800-(but._x+but._width))/2;
            mySpaceVar = 5;
            for (var i = 0; i<labels_array.length; i++) {
                var but = _root.attachMovie("btnMC", "btn_"+i, i);
                myMenuClips.push(but);
                but._y = 582;
                but.tf.text = labels_array[i];
                but.tf.autoSize = true;
                //newXPos is the left border of the element       
                but._x = newXPos;
                // so do.....for the next left border
                newXPos = newXPos+but._width+mySpaceVar;
                but.num = i;
                //////////////////////////////////////////////////////////////////////////////////
                //////////////////////////////////////////////////////////////////////////////////
                but.onRollOver = function() {
                    if (geek == 1 && this.tf.text == "ABOUT US") {
                        this.tf.textColor = 0x0000FF;
                    } else if (geek2 == 1 && this.tf.text == "MEET YOUR TEAM") {
                        this.tf.textColor = 0x0000FF;
                    } else {
                        //black
                        this.tf.textColor = 0x000000;
                    }
                };
                //////////////////////////////////////////////////////////////////////////////
                but.onRollOut = function() {
                    if (geek == 1 && this.tf.text == "ABOUT US") {
                        this.tf.textColor = 0x0000FF;
                    } else if (geek2 == 1 && this.tf.text == "MEET YOUR TEAM") {
                        this.tf.textColor = 0x0000FF;
                    } else {
                        //gray
                        this.tf.textColor = 0x999999;
                    }
                };
                ///////////////////////////////////////////////////////////////////////////////
                but.onPress = function() {
                    _root.ns.close();
                    //trace("name of Movie "+this.tf.text); 
                    if (this.tf.text == "ABOUT US") {
                        geek = 1;
                        geek2 = 0;
                        ////////////////////////////////////////////////                       
                        _root.bgSound.stop();
                        if (_root.track2 == true) {
                            _root.bgSound2.stop();
                        }
                        ////////////////////////////////////////////////
                        for (var i in _root) {
                            if (typeof (_root[i]) == "movieclip") {
                                var isMenu = false;
                                for (var c in myMenuClips) {
                                    if (myMenuClips[c] == _root[i]) {
                                        isMenu = true;
                                    }
                                }
                                if (!isMenu) {
                                    _root[i].removeMovieClip();
                                }
                            }
                        }
                        _root.gotoAndPlay("startAbout");
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////
                    if (this.tf.text == "MEET YOUR TEAM") {
                        geek = 0;
                        geek2 = 1;
                        //this.tf.textColor = 0x0000FF;
                        //blue           
                        /////////////////////////////////////////////////   
                        _root.bgSound.stop();
                        if (_root.track2 == true) {
                            _root.bgSound2.stop();
                            // Load back ground music
                            track1 = true;
                            bgSound1 = new Sound(MyMusic_mc);
                            bgSound1.loadSound("Music/body-track.mp3", true);
                            bgSound1.setVolume(25);
                            bgSound1.onSoundComplete = function() {
                                bgSound1.start();
                            };
                        } else if (_root.track1 == false) {
                            track1 = true;
                            bgSound1 = new Sound(MyMusic_mc);
                            bgSound1.loadSound("Music/body-track.mp3", true);
                            bgSound1.setVolume(25);
                            bgSound1.onSoundComplete = function() {
                                bgSound1.start();
                            };
                        }
                        ////////////////////////////////////////////////
                        for (var i in _root) {
                            if (typeof (_root[i]) == "movieclip") {
                                var isMenu = false;
                                for (var c in myMenuClips) {
                                    if (myMenuClips[c] == _root[i]) {
                                        isMenu = true;
                                    }
                                }
                                if (!isMenu) {
                                    _root[i].removeMovieClip();
                                }
                            }
                        }
                        _root.gotoAndPlay("Team Members");
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////
                    //trace("name of Movie "+this.tf.text); 
                    if (this.tf.text == "REFERENCES") {
                        ////////////////////////////////////////////////
                        _root.bgSound.stop();
                        if (_root.track2 == true) {
                            _root.bgSound2.stop();
                        }
                        ////////////////////////////////////////////////
                        for (var i in _root) {
                            if (typeof (_root[i]) == "movieclip") {
                                var isMenu = false;
                                for (var c in myMenuClips) {
                                    if (myMenuClips[c] == _root[i]) {
                                        isMenu = true;
                                    }
                                }
                                if (!isMenu) {
                                    _root[i].removeMovieClip();
                                }
                            }
                        }
                        _root.gotoAndPlay("startReferences");
                    }
//....

View Replies !    View Related
This.onPress Replacement?
this is probable a stupid question, but ive got a cool image fade animation that fade the mage out and fadea a new image in every time its clicked. its got a function that is run like so:

this.onPress = pressForNext;

but i've got a seperate movie clip of some text tweens, that i'd like to use to control the images being loaded, eg rather than trigger the ani onPress, i jsut want to tall it to play?

eg a variable or something that can tell it to plat on true and set itself back to false?

I'm getting lost, can anyone point me in the right direction?

thanks

View Replies !    View Related
OnPress Within A Function
Hey Guys,

I'm having a bit of a problem, it seems really easy but is doing my head in! I've got many box MCs within a panel MC. When a box MC is clicked i want it do drag.

I've got this code:


Code:
this.onEnterFrame = function() {
topPanel.box1.onPress = function() {
trace("hi");
};
}
};
It just doesn't pick up the onPress event for the box. If i get rid of .box1 then it works fine for the topPanel but this isn't what i want. I've got it all working using simple AS on each box MC but there are going to be hundreds of boxes so i would like to keep it all in the main AS. Is it because it's within an onEnterFrame function?

Any help would be greatly appreciated!

Thanks,

Mark

View Replies !    View Related
Activating An MC Without OnPress...
Hello All,

Maybe a simple question:

I have an MC that bounces and rotates. It is activated using:

ball.onPress = function(){
bounce_angle = roll_angle = 0;
bounce_force = roll_force = 1;
}

So, it starts when its pressed, but I want it to play when the movie starts, and not have to be pressed by the user. I tried onEnterframe and onLoad...

Any thoughts?

Thanks

Rob

View Replies !    View Related
OnPress Scoll Mc
hi im trying to set up an mc (Numbers) that scrolls onPress of a mc (fastBtn) but it doesn't seem to be working, have i stuffed up?

var myNum:Number = 0;
trace(myNum);

while (myNum > 1) {
Numbers._y -= 5;
}

fastBtn.onPress = function() {
myNum = 2;

};

fastBtn.onRelease = function() {
myNum = 0;

};

View Replies !    View Related
Two OnPress On The Same Clip
a movieclip mc has onPress=f1 in its timeline;
in the main line this clip is used as
attachMovie("mc","mc",1)
mc.onPress=f2

From what I see in this case f2() is not called

Is this how it is supposed to be?
How do I make mc.onPress to work too?

View Replies !    View Related
OnPress Issue
I'm having a problem with my onPress being triggered. I have a parent MC, let's hypothetically call it "sections". It has a bunch of MCs in it, let's say by the name of "section_1", "section_2", "section_3". On the first frame of the first and only layer inside my parent MC (sections) I have a bunch of onPress code for my children section. It worked great until I added an onPress code for my parent MC on my _root timeline. Now only my parent's onPress code is being triggered, and the onPress for the children aren't. Is there anyway to get these both to be triggered, perhaps with a mouse listener?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved