Declaring Text As "dynamic" And "unselectable"
How do I tell my text field i've made, to be dynamic text, and unselectableMy text location is: Code: this["rr_tf"+i]
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 03-16-2007, 06:31 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Unselectable Dynamic Text ?
I have some dynamic text that springs up when i hit a button... but i dont want the user to be able to highlight it with a double click of a drag,
possible ?
Declaring Variables For Dynamic Text Box
Hello,
I am trying to declare variables to be displayed in a dynamic text box, but for some reason it isnt working, even though i have done this 100 times before
On first frame is this code
green_11.text = "Insurance Industry Knowledge";
green_12.text = "92%";
green_13.text = "82%";
green_14.text = "96%";
green_15.text = "72%";
trace("green_11 - " + green_11);
later in the time line, inside a movie clip i have a dynamic text box with an instance name of green_11 it wont display..
my trace wont display either... it will if i remove the .text, but the text box still wont work
Transparent Movie File.... Unselectable Text Beneath...
I have a transparent .swf that I am exporting and then use div tags to place on my html page.... but then all selectable content beneath it dies. Does anyone know how to let the user "click through" the transparent section of the .swf file?
Creating Dynamic Class Variables Without Declaring Them First
Is it possible in AS 2.0 to dynamically create class variables without declaring them first?
I know you can do:
code:
class MyClass
{
function MyClass()
{
this["foo"] = "bar";
}
}
var MyObject = new MyClass()
trace(MyObject["foo"]);
But can you do something like:
code:
class MyClass
{
function MyClass()
{
this.variables["foo"] = "bar";
//Or
this.addVariabele("foo") = "bar";
}
}
var MyObject = new MyClass()
trace(MyObject.foo);
?
Function Question: Problem With Declaring Text Field Inside Of A MC
In "holder.prob" holder get's declared but prob isn't. Something is holding that off, can someone help me figure out what's stopping the variable from being placed? thanks
code: function storetext(MC, text1, holder,prob) {
holder._visible = false;
MC.onRollOver = function() {
holder.onEnterFrame = function() {
holder._x = _xmouse;
holder._y = _ymouse;
if (MC.hitTest(_xmouse, _ymouse)) {
mouse.hide();
holder._visible = true;
//problem begins
holder.prob = text1;
//prob never get's declared, something somewhere
//is stopping the function to place it inside
trace(holder);
trace(prob);
}
//else {
//holder._visible = false;
//mouse.show();
//}
};
};
MC.onRollOut = function() {
holder._visible = false;
mouse.show();
delete holder.onEnterFrame;
};
}
storetext(two_mc, "Split", box, x_field)
Buttons Unselectable
Hello everyone,
I'm just curious if its possible to make buttons unselectable for a certain range of frames. I don't wanna make the buttons disappear, I want them to be there but just not clickable. I have three or so other buttons on the stage that will be selectable, one of which will make the main menu move (temporarily) and during that time I don't want the buttons that will move to be clickable (though I still want them to be there ... so I don't just wanna delete them or fade them out for these frames).
Any help greatly appreciated, thanks.
GetURl Unselectable?
Hi,
Not really a problem, but I was making a simple hyperlink btn, and when I turned on script assist (cs3) and went to global functions>browser/network the getURL option wasn't selectable? I know the code any way and the instance of the btn was definitely selected. I just can't figure out why this might be?
Thanks
Making The Background Unselectable...
My site is located below. I have a few pop-up window in flash that show images and such. When these window are up the background/ layer below is still selectable. I there a script that only makes what's on top selectable. To see what I'm talking about go to the high bandwidth site, portfolio page, graphics design portfolio page and click on an image. It will pop-up. You can then hear you move the mouse around the image that the layer below images are being rolled over. It does this with completely opaque backgrounds. I've tried everything. Please help solve this problem. Thanks.
Richardson-Graphics.com
Unselectable Movie Clip
So I am working with the ZOOMIFY viewer to reduce the disc size of my images. The ZOOMIFY viewer is basically a movie clip-right now I have it set up so that the images within the ZOOMIFY viewer cannot be moved (dragged). So in a related item, is it possible to make an unselectable movie clip?
In other words, I want to know if you can control the appearance of the cursor as it physically passes over a clip, so that it does not change from the default. Currently, as soon as the cursor passes over the movie clip, the cursor turns into the hand symbol.
ActionScript Code:
on (press) {
//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior
}
Thanks
Why Are Certain Options In The Action Menu Unselectable?
I am new to Flash5 and this is what I am trying:
I have an instance of a movie clip in layer two, frame one of my movie. I right click the instance and pull up the actions menu. I want to add this code the instance as per a tutorial on this site:
onClipEvent(enterFrame){
_root.line._x=random(400);
for (i=0; i<=2; i++)
{
_root.circle.duplicateMovieClip( "circle"+i, i+1);
}
if (i=2){
i=0;
}
}
The problem is when I look into the actions menu the "OnClipEvent" option is grayed out and it will not let me select it. There are a few others grayed out as well:
else
else if
on
Why won't Flash let me select these options?
Can anyone help me?
Thanks in advance!
Making Lower Levels Unselectable
i like creating my sites into levels for fast loading purposes. if i bring up a page that purposely covers the menu and other buttons on lower levels, how do i make those buttons on the lower levels unselectable until the user closes(unloads) the top level movie. right now on the user can select anything below without even seeing it because the mouse changes to a finger. please help thanks...
this can be seen here by going to the about, then services page and click on web design. you'll see that you can select the menu still. it doesn't matter if the "background" is opaque, or if i create a graphic and alpha it for the background and if i just make a solid background, you can still always select the levels below...
http://www.richardson-graphics.com/newsite/main.html
thanks for you help
How To Make Flash Components Unselectable?
Hello
I have a group of radio buttons which under certain circumstances I want them to be unselectable, which means for them to remain on the page but be faded out and make them unselectable.
any help on this is much appreciated.
thanx in advance
Mohammad
Declaring A Tie.
Code:
if (teamA>teamB) {
gotoAndPlay("teamA_wins", 1);
//playerOne wins
} else {
gotoAndPlay("teamB_wins", 1);
//playerTwo wins
}
this is the code i am using if i wanted to add in the effect of a tie, what would the code be for that. i am thinking it might be
Code:
if (teamA>teamB) {
gotoAndPlay("teamA_wins", 1);
//playerOne wins
if(teamA=teamB){
gotoAndPlay("tie", 1);
//teams tie
} else {
gotoAndPlay("teamB_wins", 1);
//playerTwo wins
}
but i am not for sure that this is the answer, so if someone could look at it i would be very thank you
Declaring Variables
hi,
Does flash assign default values to variables if not declared previously? Like in the sample below
onClipEvent (mouseMove) {
n++;
if (n == 5) {
i++;
duplicateMovieClip (_root.effect, i, i);
setProperty ("/" add i, _x, _root._xmouse);
setProperty ("/" add i, _y, _root._ymouse);
n=0;
}
}
the variables "n" and "i" were not defined previously.
Declaring Variables
Im trying to set a "global" variable that gets its value from a mc that contains a dynamic text field. I cant see to get it working..
I need to be able to pass this onto a new scene..
Just one other thing.. do i reference this new variable in the new scene as _root.variable-name?
Skek
Declaring Variables
Hi, I'm a newbie. Im trying to set up a shopping cart. I have set up a series of dynamic text fields to add items to each time a product's Add to SC is pressed. What I want to do is add a counter each time another item is added so I can specify which field to place next item in.
1/ Where would I declare my counter variable, it must be seen by all Add to SC buttons throughout catlogue.
2/Can I concatenate variable names ie where item = item and counter = 1 - will item + counter = item1
Declaring A Function
I'm interested in finding out whether there is ANY difference to declaring a function as:
Code:
function myFunction() {};
or by using a variable
Code:
myFunction = function() {};
I know they both WORK the same, but is using the variable actually adding any extra overhead to your movie? Looking in the Debugger, the results for both look identical.
Any definitive reason why one is better than the other? Thanks.
Declaring Constants
How do you declare a constant in Flash MX? For example, I need a constant integer.
In java this is done by:
final int name;
In C++ this is done by:
const int;
How can I do something like this in Flash?
Declaring Variables
Hi,
I am creating a full flash site and want to create a variable which will store which section/page the user is on. What code would I use to set the variable to something like "Home" and then what code do I need to insert in my buttons changing that value when they navigate to another section.
Thanks
Declaring Variables
flash mx
is there any way i can declare variables using loop or something, instead of declaring each and every one individually
like how can i declare 50 variables in a short way instead of:
var v1, v2, v3, v4, v5.... v50;
is there any other way that is easier and shorter???
Declaring Functions On The Fly...
Hi.
I am using duplicateMovieClip to create a number of movie clips that must each have their .onRollOver and .onRollOut behaviours.
The number of clips that I will be creating will be drawn from an xml file, and so the names of the clips cannot be hardcoded because I do not know how many there will be.
Can I write some kind of universal function to handle the onRollOver and onRollOut methods for all. Note: I must be able to capture the _name of whichever clip is being used.
If I have been unclear, just ask and I'll clarify.
Many thanks in advance,
Adam
Declaring Arrays
In actionscript is there a way to do something like this...
var myVar = 5;
var myArray[myVar][3];
var myOtherArray[myVar][myVar];
Basically I want to use a variable to declare a multidemsional array, is this possible?
Declaring Vars
Hi guys!
Well i use flash to animate stuff and i dont know much of actionscript.
My question is:
imagine i have 3 menus. each time u click in one he makes a moove and go to a diferent place.
The problem is how do i tell the movie that if i click the 3rd menu, and the 2nd one is up i want the 3rd to go back?
i know that is something like:
if menu3 == 1{
gotoandPlay (10)
but my answer is: how the hell i tell to a movie that his state is 1 or 0?
Declaring Variables
Long story short, I have one .swf.
In that .swf I have a movie clip.
In that movie clip I have a FOR loop.
In the entire .swf I have a movie clip that is in the library and is able to be exported for actionscripting.
In the FOR loop I attach the movie from the library.
So now we understand that the attached movie is NOT a seperate swf file. It is all in one .swf file.
In the FOR loop, I want to pass along a variable to the attached movie clip.
How do I do that without using _global variables?
In detail, this is the loop and the problem i'm having.
for (_global.count=1; _global.count<=sectionTotal; _global.count++) {
this.attachMovie("Small_Loader", "small_loader"+_global.count, _global.count+10);
small_loader[_global.count].small_image_mc.loadMovie("fscommand/Images/medium/"+_global.portsection+""+_global.count+"medium.jpg ");
}
I want to pass along the current value of _global.count to the attached movie clip. The way I initially tried that was that within the attached movie clip I assumed that when it was loaded via this FOR loop, that the _global.count would not update and it would retain the value that was assigned to it when the movie clip was loaded. HOWEVER, I soon found out that the FOR loop had run so quickly, that by the time the 1st attached movie clip was loaded, the FOR loop had already run through the _global.count sectionTotal and had exited. So when the attached movie clips looked at the _global.count variable, it was always 1 higher than the sectionTotal variable.
What I want to happen is that let's say on the 1st iteration of the FOR loop, I want the current value of _global.count to be transferred to the 1st attached movie clip (Which happens to be "Small_Loader"). So when small loader runs, it will retain the value of 1 for _global.count. When the 2nd iteration of the loop happens, the 2nd attached movie clip will retain the value of _global.count = 2. So on and so forth. But like I said, the FOR loop happens so quickly that the _global.count never takes hold properly in the attached movie clips. How do I transfer the current _global.count variable from within the FOR loop, to the attached movie clip on any given iteration of the FOR loop?
---------
for (_global.count=1; _global.count<=sectionTotal; _global.count++) {
this.attachMovie("Small_Loader", "small_loader"+_global.count, _global.count+10);
small_loader[_global.count].small_image_mc.loadMovie("fscommand/Images/medium/"+_global.portsection+""+_global.count+"medium.jpg ");
}
---------
Declaring Variables [F8]
Have been doing some reading and everything I've come across says you don't have to declare a variable type in flash the way that you have to in other languages (dim x as integer etc.. etc...) but I've come across a tut. that has
var dir:Number = 1;
I understand that the "var" declares it as a local variable, does declaring it as a number conserve memory? and if something is declared as a number, would it generate a type mismatch error if somewhere along the line you tried to make Number="some text here"?
thanks heaps in advance
Help With Declaring Variables Using Var
hi guys
i'm having trouble writing variable names
I used to write something like this when joining some text and the contents of a variable:
_root["fruit_"+type] = "banana";
how can I write this with var before it?
e.g.
var ["fruit_"+type]:String = "banana";
doesn't work
many thanks
[F8] Declaring Integers?
just a quick question..
how to declare integers?
I've always used
var counter = 0;
and that worked,
i saw an int in actionscripting
but doesnt it work like in VB?
int counter = 0; ?
Declaring A Variable?
If I draw a dynamic text field on the stage and give it a name in the Var field within the Properties panel is that essentially declaring a variable?
Puke
Problems Declaring Var...
function cycleLoad works... it attaches 6 movie clips to the stage in a circle.. which is what i want.. im having troubles declaring the
var theMovie:MovieClip = _level0.container_mc_["item" + i];
when i trace the icon when its click.. it outputs 6 undefined, when i want the name of the clip and the container clip..
basically, when the user rolls over one of the six icons, the icon zooms up with the tween class, then function out(), zooms back to _x,_y positions..
heres my code...
var radiusX:Number = 180;//width radius of cycle for the animated icons
var radiusY:Number = 150;//height radius of cycle for the animated icons
var centerX:Number = 250;//X center of cycle
var centerY:Number = 210;//Y center of cycle
var cycleRotate:Number = 300.03;
//var home:MovieClip = this;
var arrowCenterX:Number = 110;
var arrowCenterY:Number = 80;
var arrowRadiusX:Number = 0;
var arrowRadiusY:Number = 0;
var menuIconsArray:Array = new Array("healthySkin", "environMoist", "lowerSkin", "drySkin", "waterInfusion", "healthyCellular");
function cycleLoad() {
for (var i:Number = 0; i < menuIconsArray.length; i++) {
var emptyClip:MovieClip = _level0.createEmptyMovieClip("container_mc_" + i, _level0.getNextHighestDepth());
var theMovie:MovieClip = emptyClip.attachMovie(menuIconsArray[i] , "item" + i, emptyClip.getNextHighestDepth());
trace("attaching " + menuIconsArray[i] + " to" + " cont" + emptyClip);
trace("poo " + theMovie);
trace("ass " + emptyClip);
theMovie.angle = i * ((Math.PI * 2)/menuIconsArray.length) + cycleRotate;
theMovie.onEnterFrame = placement;
theMovie.onRollOver = over;
theMovie.onRollOut = out;
theMovie.onRelease = released;
}
}
cycleLoad();
var arrowMC:MovieClip = _level0.attachMovie("arrows", "arrows", 0);
arrowMC.onEnterFrame = placement;
arrowMC._x = arrowCenterX;
arrowMC._y = arrowCenterY;
function over(){//show movie clip icon and follow around cycle{
for (var i:Number = 0; i < menuIconsArray.length; i++) {
trace(_level0.container_mc_["item" + i]);
var theMovie:MovieClip = _level0.container_mc_["item" + i];//reference to the item/icon in the cycle
//var emptyClip:MovieClip =
theMovie.xPos = theMovie._x;//store current x position
theMovie.yPos = theMovie._y;//store current y position
theMovie.theScale = theMovie._xscale;//store scale
if (theMovie = this._parent) {//icons that weren't click do the if
var tw:Tween = new Tween(theMovie,"_xscale",Strong.easeOut,theMovie._ xscale,120,0.5,true);//new Tween(which item to animate, which property to animate, type of easing, start value, end value, time, true = seconds);
var tw2:Tween = new Tween(theMovie,"_yscale",Strong.easeOut,theMovie._ yscale,120,0.5,true);
var tw3:Tween = new Tween(theMovie,"_x",Strong.easeOut,theMovie.x,theM ovie.xPos,0.5,true);
var tw4:Tween = new Tween(theMovie,"_y",Strong.easeOut,theMovie._y,thM ovie.yPos,0.5,true);
}
}
}
function out() {
for (var i:Number=0; i < menuIconsArray.length; i++) {
var theMovie:MovieClip = _level0["item" + i];//reference to the item/icon in the cycle
theMovie.xPos = theMovie._x;//store current x position
theMovie.yPos = theMovie._y;//store current y position
theMovie.theScale = theMovie._xscale;//store scale
if (theMovie = this._parent) {//icons that weren't click do the if
var tw:Tween = new Tween(theMovie,"_xscale",Strong.easeOut,theMovie._ xscale,100,0.5,true);//new Tween(which item to animate, which property to animate, type of easing, start value, end value, time, true = seconds);
var tw2:Tween = new Tween(theMovie,"_yscale",Strong.easeOut,theMovie._ yscale,100,0.5,true);
}
}
}
thanks..
Declaring Variables
Im having a hard time trying to declare these variables:
ActionScript Code:
For(var i = 1....){
name+i = ...
link+i =...
I want it to create the variable name1, link1, name2, link2... and a lot more, so Im using a FOR to do that, but it tells me that something is wrong with the name+i part of the code, I assume I cant refer to a variable to be created with variable+another_variable = something.
How can I create these variables ??? Im sure its pretty simple, but I can't figure out. Thanks.
Declaring Max Radius
I like to control the radius of the circle according to the number text in it. For example the code below the number text is (332) so i would like to set the radius of the circle to (332) but it turn out that 332 is too large a circle. so what actionscript should i add in to declare the max radius is 2cm but in a way that 332 = 2cm. because i want to put the radius as 332 so it will be clearly instead of having to count the radius myself as i have 10 circle of different number text. The max number text is 332.
ActionScript Code:
MovieClip.prototype.drawCircle = function(r, x, y) {
this.moveTo(x+r, y);
a = Math.tan(22.5 * Math.PI/180);
for (var angle = 45; angle<=360; angle += 45) {
// endpoint:
var endx = r*Math.cos(angle*Math.PI/180);
var endy = r*Math.sin(angle*Math.PI/180);
// control:
// (angle-90 is used to give the correct sign)
var cx =endx + r*a*Math.cos((angle-90)*Math.PI/180);
var cy =endy + r*a*Math.sin((angle-90)*Math.PI/180);
this.curveTo(cx+x, cy+y, endx+x, endy+y);
}
}
var circle332 = this.createEmptyMovieClip("circle", 1);
circle332.beginFill(0xffff00, 100);
//adjust the size and placing of the circle
circle332.drawCircle(32, 174, 119);
circle332.endFill();
var tFormat = new TextFormat("circle",1);
tFormat.font = "Arial";
// use this for legend tags and rollover notes
tFormat.size = "35";
tFormat.color = 0x000000;
this.createTextField("moreinfo", a*20+3*(angles.length+30), 141, 98, 100, 100);
this.moreinfo.setNewTextFormat(tFormat);
this.moreinfo.text = "332";
Declaring Variables In AS2
In converting from AS1 code to AS2, I don't know how to declare variables that are part of a set. eg I have a set of buttons and want to change the state of each button depending on the value of another variable. So I use the variable .assign for each of the buttons. How do I declare this type of variable?
Attach Code
Set the value:
_root.N1["button"+countst].assign = NavArray[i+2];
Check the value:
if(_root.N1["button"+countst].assign == 1)
Declaring Function/
i want to write a function which has 2 dimentional array as one of its arguments
_global.getList = function ( type:Number, list[]:Array )
this is giving syntax error,
if i do
_global.getList = function ( type:Number, list:Array )
then there is no error, but then, list is now, single dimentional array, which i dont want.
whats the correct syntax to write it as two dimentional array ??
Declaring A Variable
Ok this might be lengthy..but easy for most im sure..Ok I have MC..and whenever u click a button on the menu bar I want this MC to activate on both sides of the button. Ok so for now I have 2 buttons..one is TEAM and the other is PRODUCT. So if u click team button the MC's activate..Now if u click PRODUCT I want the MC's from the team button to unload and the ones on the sides PRODUCT to now load.. Ok so I achieved this using "in" and "out" with the main MC (i just duplicated it many times giving each a diff instance name for each button). Ok so heres my script for TEAm button..this works however I was told I need to declare the variable pressed or not_pressed on the main timeline..Does anyone know how I do this? Any explanation would be great..Cause I just dont get it Thanks!!!
Declaring Variables
Hi,
I am creating a full flash site and want to create a variable which will store which section/page the user is on. What code would I use to set the variable to something like "Home" and then what code do I need to insert in my buttons changing that value when they navigate to another section.
Thanks
Declaring Variables
What is the difference between declaring a variable like this:
variable = 1;
and declaring it like this:
var variable:Number = 1?
Why is it better to use the second way?
Declaring A Variable
hey, this is about declaring a variable.
if i want to declare a variable called xpos
can i just write it on a mc like this
xpos = getProperty (bla bla bla bla);
by itself???
Declaring Function/
i want to write a function which has 2 dimentional array as one of its arguments
_global.getList = function ( type:Number, list[]:Array )
this is giving syntax error,
if i do
_global.getList = function ( type:Number, list:Array )
then there is no error, but then, list is now, single dimentional array, which i dont want.
whats the correct syntax to write it as two dimentional array ??
Declaring Variables.... I Forget How.
Hey ppl,
I think I used to know how to do this but since the work I am getting lately is so inconsistent, I think I forget how.
I need to pass a swf to a guy for use in Authorware.
He wants me to make a blue square, and a green square.
And when the variable = "blue" he wants the blue square to come up, when the variable = "green" then the green square needs to come up.
I have no idea if I should make this a 3 frame swf, with nothing in the first frame, and a blue square on frame 2, a green square on frame 3... etc. Or make it all a movie clip? I have no idea where or how to even begin.
Please help me, maybe once this is answered I can remember how to do other stuff too.
Thank you very much.
Declaring Variables *curiosity*
whats the difference between writting:
var When=0;
or
When=0;
or
set(when, 0)
???????
I see these 3 different types of declarations, but I cant tell the difference btw then
Help files didnt help me understanding it....
Declaring A Component As A Variable
Hi,
I'm sure this is a stupid question, but how do I assign a component (in this case a combo box) as a variable??
I can easily assign an instance name and fill it's contents, but I can't figure out how to assign the variable to send the information to an ASP form.
Please help. I am using Flash 8.
Thanks.
Declaring A Component As A Variable
Hi,
I just posted this in the newbie section, but figured I post it here also, maybe some of you guys might be able to shed some light on the subject...
I'm sure this is a stupid question, but how do I assign a component (in this case a combo box) as a variable??
I'm trying to create a simple request form in my flash 8 program using components.
I can easily assign an instance name and fill the combo box contents, but I can't figure out how to assign the variable to send the information to an ASP processing script.
Please help.
Thanks.
Different Ways Of Declaring Verables.
could you explain how each one can be used?
----------------
//1
bob = 1
//2
_root.bob = 1
//3
_global.bob = 1
//4
var bob = 1
------------------
(P.s.code tags working)
Declaring Variables Within A Loop
Hi im making a flv thumbnail preview gallery..this requires me to define a lot of netstream objects... not sure maybe my brain isnt working today but trying something like this
Code:
var noMovies:Number = 20;
for(var i:Number=0; i < noMovies; i++){
var _root["ns"+i]:NetStream = new NetStream(nc);
_root["ns"+i].setBufferTime(0.1);
}
however i get a syntax error expected '{' etc etc .. thanks in advance for your help!!
When And When Not To Use Var When Declaring Variables, And When To Datatype
Hello everyone, I'm a pretty uh...well, what's the level right above "noob" when it comes to Actionscript?
Well, whatever that is, I'm it! And there are a few things that I just don't quite get.
1. When and when not to use var when declaring variables.
var sometext = "blah";
vs.
sometext = "blah";
I see people use them on and off, sometimes they do sometimes they don't. What's the right method?
2. Datatyping. When to use it and when not to. From what I understand, if you datatype your variable Flash will sense that and offer relevant codehints and available functions while your typing. Like, say If I declare...
var listener:Object = new Object();
If I begin typing listener. flash will show a list of all the available functions and...constructors, whatever they're called. Is that all the datatyping does?
Well, uh, thanks! Those are my questions.
Declaring An Array Outside Of A Function?
Works:
function nature_images() {
_root.nature_images = ["sila", "silb", "silc"];
i = _root.nature_images.length;
k = Math.floor(Math.random()*i);
trace(_root.nature_images[k]);
}
nature_images();
Does not work:
_root.nature_images = ["sila", "silb", "silc"];
function nature_images() {
i = _root.nature_images.length;
k = Math.floor(Math.random()*i);
trace(_root.nature_images[k]);
}
nature_images();
Why?!
|