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




SetProperty Question



hey people my first post on FK -=)

any how am now starting and trying some basic action.
i got a MC moving from the left of the stage to the right,
but what if i wanted it to start from the middle of the stage and go to the right -=) instead of going left.
my stage is w400 h250 thank you

My Code
__________________________________

onClipEvent (enterFrame) {
b = 10+b;
setProperty ("_root.ball", _x, b);
}



FlashKit > Flash Help > Flash ActionScript
Posted on: 06-14-2001, 11:01 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Setproperty
i am having loads of trouble with the setproperty function. all i am trying to do is set the x-scale of a graphic to myvar%.

any code or suggestions please!

SetProperty... I Don't Know If Im Doing It Right?
Hello and thank you forum....

here's the dilly. Im trying to get an MC to start off invisible and then when I press a button..... get the MC to become VISIBLE. Sounds simple, which Im sure it is... but It's not working... here's my code

onClipEvent (load) {
setProperty ("MC", _visible, "false");
}
and then for the button

OnPress
setProperty ("MC",_visible, "true");

it doesn't even start off invisible??

HELP

Setproperty, Help
Well, here it goes:

I got two buttons in a "menufolder" folder. They are called "fol1" and "fol2".
Now when you clic on "fol1", "fol2" should move

so i got this actionscript in "fol1"

on (release) {
setProperty ("fol2", _y, "185");
}

when I test, the only things that happens with the button when I click, is the down state... nothing else, no error... Can anyone help me?

I am using flash 5.
[Edited by dandin1 on 03-15-2002 at 06:57 PM]

Setproperty
can any1 help ::

in the first frame i have :
loadMovieNum ("pca.swf", 0);

in the second frame i want to set the position of the movie so i have :
setProperty ("0", _y, "195");

now the second action doesnt seem to do anything and i have tried to follow
the instructions of a tutorial but now my head is about to explode ..
thanks if u can

SetProperty
// setProperty("_root.holder", _width, "85");
// setProperty("_root.holder", _height, "111");
// loadMovie("des6Contents.swf", "_root.holder");

I can''t seem to get these three lines of code to work together. When I comment out the two setProperty line the movie scomes in fine, but as soon I put those two line of code in nothing loads in (or at least I can't see anything).

What do you think?

Thanks
Erik

Setproperty
How does one setproperties for new movies being loaded so they appear in a particular location in the main movie level 0. I do not want to go back and resize all the movies that I am loading. I basically want my home page to stay the same and load new swf files into a specific area on the page. Each buttong will load different swf files back and forth. I know how to load and unload, but can not resize and place them on the main level.

Are movie clips better. If so why and how. I am having trouble with them.

Thanks.

Pkab

SetProperty()
I want to know if you can use the setProperty() function to change the _x(x position) of an object in a different frame on the stage.

Setproperty()
I want to make a button that maks another button move sidways when my mouse goes over it but it does's seen to work. This is the actionscrpt I used:

on (rollOver) {
setProperty("button2", _x, "getProperty(button2, _x)+20");
}

SetProperty
Am I missing something here? Real simple


Code:
loadMovieNum ("music.swf", 1);
setProperty ("_level1", _x, "300");
setProperty ("_level1", _y, "125");


I've even put the setproperty's in the next frame just in case.

Why does the loaded movie "music.swf" not get placed in the said x and y values?

thanks in advance!

SetProperty. Help
Im working on a navigation which in a MC called thumbs (containing thumbs of larger images to be loaded) I have added a clip event to each thumbnail within mc_thumbs that dynamically loads jpgs into _root.photocontainer_top.photocontainer.

heres the code for that:
onClipEvent (mouseDown) {
if ((this.hitTest(_root._xmouse, _root._ymouse, true))) {
_root.nav.thumbs.nav01.gotoAndPlay("true");
loadMovie("http://"target"/photo_01.jpg", "_root.photocontainer_top.photocontainer");
}
}
OK..that works well.

Next, I need to set the _y property of mc_photocontainer_top to adjust for the width of each jpg.
I added a loop in mc_thumbs thats always checking the width of mc_photocontainer(this is the target of which the jpgs are loaded to) and I also want it to use this info to adjust for when a jpg with a different width is loaded in. The reason Im using a looping timeline to do this is that in order for a property to be changed, mc_photocontainer must be populated by the jpg that the property will be taken from. Hope that makes sense.

This is where Im having a problem setting the property:
On the frame thats being looped I put this code...and many variations, but I cant seem to get it to work.

width = "getProperty(_root.photocontainer_top.photocontain er, _width)";
setProperty("_root.photocontainer_top", _y, 360 - "width");

Im sure its a matter of syntax...im really rusty at this stuff and Im always confused about when I should use expressions or not.

TIA!

SetProperty
Hi,

I got a simple question. But not quite sure how to go about it.

I'm using set property scale a movie:
on (release) {
setProperty(_root.skate,_yscale,500);
}

I have the movie clip on the main timeline called "skate". Now I want it to scale with a motion tween;

Any ideas.

regards,
shalin

SetProperty
Hello,

Im new to flash and need help

I have a few movies which act as menu buttons in my .fla

What I want to do is make one movie clip move to a set position when the mouse rolls over another. I have given the desired movie clip an instance name and tried using the setProperty control and changing the _x value without any luck. Does anyone know what I am doing wrong?
Thanks in advance.

SetProperty
hi. i'm familiar with code but new to actionscript. this is probably a stupid question.

the following bit is used across half a dozen instances of a button. i want the 'spark' to fire somewhere near the coords of the mOver (doesn't have to be precise), but this keep returning the same position for EVERY instance - the top left corner of the uppermost button instance. how can i fix it?

tyia


Code:
on (rollOver) {
temp = 1;
while (Number(temp)<=10) {
current = random(1000);
duplicateMovieClip("/spark", "spark" add current, current);
setProperty("/spark" add current, _y, "random(1000)");
setProperty("/spark" add current, _x, "random(1000)");
set("/spark" add current add ":xspeed", Number(random(6)-3)+1);
set("/spark" add current add ":yspeed", random(8)*-1);
set("/spark" add current add ":zspeed", random(10)-5);
set("/spark" add current add ":fade", Number(random(5))+3);
temp = Number(temp)+1;
}
}

SetProperty?
I need a little bit of help with setProperty. I've got a Movieclip, with this code on it:

code:
onClipEvent (enterFrame) {
if (this.hitTest(_root.chara._x_root.chara._y, true)) {
_root.instancename = _root.baackt.console1;
_root.MakeLight();
}
}


the thing that _root.instancename is being set to is the instancename of the movieclip. Then, for my function MakeLight, I've got:

code:
function MakeLight() {
setProperty(instancename, _alpha, 25);
}


does anyone know how I can actually get the function to set the property of the instancename mentioned in the variable? I've been trying all the tricks I know, but haven't figured out a way to yet.

Thanks,
Spidy

SetProperty
i am trying to make the mc gun hide unless you have the space bar pressed down. on thefirst frame i have it hidden and then the following to make it show. but its not working. does setProperty not work with mc's?

[code]
onClipEvent (enterFrame) {
if (Key.isDown (Key.SPACE)) {
setProperty("gun", _visible, "1");
}
}

SetProperty
Shouldn't these two lines do the same thing?

code: _root.mc._alpha = 0;

setProperty("_root.mc", _alpha, "0");


I have a button inside of a mc named intro, which is on the _root. On that button I have:

code: on(release){
_root.gotoAndPlay("someFrame");
_root.paused._alpha = 0;
}

And on the _root I have a mc named paused.

When I press the button, the _root does gotoAndPlay, but paused does not change it's _alpha to 0.

However if I use setProperty it does work. Where is my confusion in this?

Thanks.

_t

Is This A BUG? SetProperty And Var Name
Hello

I've been trying to do something that detects the first object in a row of MC's and "swaps" it with another the user clicks (if he selects the 1st, it will stop).

What happens is that, even tracing every var and knowing they have the correct names, I can't seem to make even a simple SetProperty action on the "HITTED" MC (the one over the hitarea).

I've tryed using arrays to define position and setting the MC's into their _x according to predefined values, but the SetProperty always fails.

Can someone please help. Am I doing something wrong? Is this a bug? I've upload the swapingmanual.fla.

Thanks in advance.

SetProperty Help
I am trying to make it so that a movieclip grows a little after a certain amount of time, but i cant qutie get it to work:

if(_root.timer == 50){
setProperty(enemy, _width. 25);
}


It would be better if i could get it to increase size instead of having to repeat the code. Any help is greatly appreciated.

SetProperty Help
I am trying to make it so that a movieclip grows a little after a certain amount of time, but i cant qutie get it to work:

if(_root.timer == 50){
setProperty(enemy, _width. 25);
}


It would be better if i could get it to increase size instead of having to repeat the code. Any help is greatly appreciated.

Setproperty
I am trying to load a .swf into another swf. The problem is the movie clip that is being loaded is larger than the space that I want it to take up in the main swf. How do I load it where I want it and have it sized the way I want it? Please help. This is driving me crazy.

Setproperty
hi
can anybody explain me the setPropety funtion

What Should I Use Instead Of SetProperty?
I am editing a scrollbar I made years ago and in the code are these lines:

setProperty("_root." add thetarget, _y, originaly);
setProperty("_parent." add thetarget, _y, originaly-scrollRatio*hiddenHeight);

When I wrote this it worked fine because I was using AS1, but now I am using AS2 and these lines do not work.

Can someone help me out, what can I swap this for?

Cheers

Get/setProperty
im still trying to get a movie clip to 'hover' over another. i have succeeded in getting this to happen, however getting the registration points to match has been a problem. even using codes supplied by forums members, has unfortunately not workedm but i have learned A LOT, many thanks!

i have figured so far that i need to get the position of myCar movieclip in order to set that property to Light1 movieclip that is to 'hover' above myCar. however there is another movieclip Light2 that resides inside Light1. Light2 is aligned Left <100px from the centerStage of Light1.

i don't know the exact code to get the registration point of Light2 mc to be the coordinates that are used for the Light1 mc to 'hover' above the myCar mc.


Code:
onEnterFrame=function(){
this.Light1.Light2._x=this.myCar._x
this.Light1.Light2._y=this.myCar._y
}
i KNOW i'm missing something - i just dont know what. i dont know how to use the get/setProperty and the myVar.object. i experimented with those yesterday and while it looked easy to understand on the liveDocs, applying the principles werent working -

im a programmer - stuck in an artist's brain - it sux

thanks

SetProperty
I have a MC that I am duplicating on stage. The code I have for the setProperty is
Code:
setProperty("sparks", _x, random(500));
setProperty("sparks", _y, random(200));
Of course the duplicates are going from 0-500 on the _x, and 0-200 on the _y. How would I make it so the duplicated mc's only appear between 400 and 500 on the _x, and 100 and 200 on the _y? I tried several different ways but they don't seem to work.
Any help? Thanks

SetProperty
Hi,

Im struggling to figure this problem out. I have four movie clips on the stage and I want to have a button that when clicked the setProperty function is called and the visibility of 3 clips is set to false and one is set to visible.

Can someone please help me with this Im killing my brain why i cant figure this out!

I basically just want my button to change the content which is the 4 movie clips.

Cheers for any help

SetProperty
Hey everyone, flash newbie here. Just want to ask a simple question about setProperty.

Why do we use it anyway? For example, wouldn't "target._xscale = 100" be alot easier then setProperty("target", _xscale, 100)?

Thanks in advance.

SetProperty
hai guys
i m new to flash scripting, can anybody tellme abt "setProperty" and abt all of its property like ,,"_x,_y,_xmouse,_ymouse, etc"

any reply will be highly apprecialbe
with regards
maggi

Setproperty
hello! Am new here in ultrashock and I read some of the tutorials but one thing stumped me...

this code:





on (keyPress "<Left>")
{
var a;
while (a!=0)
{
a=getProperty(this,_x);
a--;
setProperty(this,_x,a);
}
}

Am using MX 2004 and the 'this' pertains to an animated GIF. I had in mind that when I press the left button, the gif would move to the left. But unfortunately, the GIF just jumps to x coordinate 0. Am I missing anything here?

Thanks for the help guys!

Help Plz Cant Use Setproperty On _X :(
Hi folks,

Been trying to get a little flash script runing that saves co-ordinates into a file (via PHP) then reads it back and places objects on the screen where they were last left.

It works on the _Y plane but the _X doesnt want to work.

Can a guru have a qukck look thanks.

Regards,

Rikki

SetProperty Not Working...
I'm trying to make a "memory" game where a card flips over when you click on it, and if it's the second card, it flips over, pauses, then flips back over (if they don't match). The setProperty function, however, waits until *after* all the functions in the on(release) function are executed, meaning the card never flips over. Here's the code, any help would be greatly appreciated:

function clicked(num) {
thenum = num;
num = picsArray[num] + 1;
setProperty ("_root.square" + num, _visible, false);
setProperty ("_root.pic" + num, _visible, true);
checkPaired(num);
}

function checkPaired(num) {
num = picsArray[num] + 1;
if ( lastpicked == null )
{
lastpicked = num;
}
else {
for ( i = 0; i < 10000; i++ ) {
if( null ) {
getTimer();
}
}
clearLast(num);
}
}

function clearLast(num) {
if ( lastpicked - 10 == num || lastpicked + 10 == num ){
setProperty ("_root.pic" + num, _visible, false);
setProperty ("_root.pic" + lastpicked, _visible, false);
}
else {
setProperty ("_root.pic" + num, _visible, false);
setProperty ("_root.square" + num, _visible, true);
setProperty ("_root.pic" + lastpicked, _visible, false);
setProperty ("_root.square" + lastpicked, _visible, true);
}

lastpicked = null;
}

SetProperty For Buttons?
Is it impossible to use setProperty for buttons?

Can I SetProperty Of A Submovie?
Can I setProperty of a submovie?
I have a movie (B) in a movie (A).
I put the parent movie (A) onto the main timeline.
Is it possible for me to change an attribute of the submovie by using setProperty?

i.e. setProperty (MovieA.MovieB, _visible, "0");

I've tried experimenting... but each time I make a call... the parent movie gets set the attribute I'm trying to change.

Or, should I be using different syntax?
[Like square brackets or something?]

I'd apprecite if someone could confirm or deny if the above is possible or not.

Thanks.


Jam

SetProperty Or Dot Syntax
hi,
who knows the exact difference between the dot-syntax and the setProperty syntax.
in my function:
the setProperty-version works:

function bewegen() {
var cleanup = -200;
setProperty (Picture1, _x, cleanup);
setProperty (Picture2, _x, cleanup);
}

but the dot-version doesnt:

function bewegen() {
var cleanup = -200;
Picture1._x = cleanup;
Picture2._x = cleanup;
}

Picture1 and Picture2 are Variables.

it only works if I use eval for the Variables that hold the path, why is it so and why can I use the cleanup-variable as it is.

function bewegen() {
var cleanup = -200;
eval(Picture1)._x = cleanup;
eval(Picture2)._x = cleanup;
}


I never really understood the meaning of the eval and the situations where I cant use a variable directly, sometimes I make stupid workarounds with many temporary Variables and putting things into strings and back (especially when I want to adress Instances by loops with counters where the Instance-path is generated). does anybody know any valuable rules to handle these problems.

Who Knows Their Stuff > SetProperty()
Is there a way to use setProperty() to change the scale of something gradually. I want to be able to have a zooming in and out effect without using motion tweening.

Right now, I had:

on (release) {
setProperty ("Box", _xscale, "60");
setProperty ("Box", _yscale, "60");
}


This just jumps straight to the smaller scale image. I want the scale to gradually go down. I imagine this is some sort of looping function but I'm drawing a blank on how to do it.

Thanks for your help in advance guys.

- Matt

SetProperty, Boy Am I Stupid
Well, this time I don't understand setProperty.

On (release)
setProperty

and then I fill in the blanks in normal scripting mode. Trouble is that it affects that instance rather than the one the string specifies. I'm trying to change the alpha of a movie clip when another button is clicked.

thanks,
sweet_jesus

SetProperty And Buttons...DOH
Ok, here's my question

I have a few buttons. When you roll over them, i want it to change the location of an image(scroll the image). it works when you roll over it the first time, but when you do it again, nothin' happens..WTH is up w/ that?


how do i fix it? Tried using rollOver, rollOut, onRelease...nothin heps...

thanks in advance

-Justin

SetProperty Problem
Hi, all

the following piece of code makes my movieclip instance dum1 dissappear

on(release){
setProperty("dum1",_visible,false);
}

all very nice, but I want it to dissappear without the user explicitly pressing a button.

setProperty("dum1",_visible,false);

On it's own as an action in a frame does nada. What went wrong?

SetProperty Visibility Help
help me please!

i need to learn how you use the setProperty+visibility stuff to make the contents of a layer be visible, and invisible, with a click of a button?

please point me with specific instructions or a tutorial.....

PLEASE HELP ME! I WILL WORSHIP ANYONE THAT HELPS ME

SetProperty _rotation
I'm trying to learn how to use the setProperty _rotation actionscripting to rotate movie clips. There is a flashkit tutorial located at:

http://flashkit.com/tutorials/Action...33/index.shtml

Either it doesn't work or (more likely) I'm just not getting what's being said, though it seems very straight forward.

Could someone take a couple of minutes to verify if the tut is correct? If it is, I'd like to have someone look at my .fla of this tut to see where I'm off base.

Thanks,

Kevin

SetProperty Visibility....
Hi,
I am trying to load a scene with buttons at the top of the page. Attached to each button is a movieclip that I would like to appear when you press the button. I am trying to do this using the visibility option for the setProperty. Unfortunately this doesn't seem to be working for me...

This is the code I am using when the page first opens:

stop ();
setProperty ("text", _visible, "true");
setProperty ("bass", _visible, "false");
setProperty ("piano", _visible, "false");
setProperty ("drum", _visible, "false");
setProperty ("trumpet", _visible, "false");
setProperty ("sax", _visible, "false");


Is this wrong? Can someone please help?

Thanks!

Problems With SetProperty From MC?
I have a dynamic textfield on the main time line called, "name_txt". I also have a MC that contains a button in it. When I test the movie the textfield _visible property is initialized to false. Then when I click the button, I want my textfield to appear. Why doesn't my AS for the button set the textfield _visible property to true?


Code in button:
<CODE>
on (release) {
setProperty(_root.name_txt, _visible, true);
}
</CODE>

SetProperty Question
i am trying to teach myself actionscripting thru tutorials........i realize this may sound stupid but here is my question:

i made a movieclip and called it "redball"
then placed it on the main timeline on layer1

then made a button named button and placed it on layer 2
and attach the following actionscript to the button:

on release{setproperty("_root.redball",_width,100);
}

why doesen't it change the size of "redball" when i click the button.

the mainmovie is 1 frame as is movieclip if that matters.

just trying to attempt to use and test setProperty actionscript.

any help would be appreciated.

SetProperty Question
Hello!

Before I begin, thanks for any help in advance.

I have a button contained in a movieclip. The MC has an instance name of menu2 and is located on level 1.

I am trying to assign four actions to the button upon release:

1. loadMovie into level 2
2. setProperty alpha 100% (for another MC nav bar)
3. setProperty _visible false (for MC menu2)
4. setProperty alpha 0 (for MC menu2)

Everything works except for the setProperty _visble action. Can a button contained in an MC disable that MC with the _visible command? Is there a better way for a button contained within an MC to disble that MC?

I am a nonprogrammer and any help would be appreciated!

Here are the actions from the button:

on (release) {
setProperty("_root.menu2", _alpha, "0");
setProperty("_root.menu2", _visible, "false");
setProperty("_root.menu", _alpha, "100");
loadMovieNum("digital/dig1_1.swf", 2);
}


Pablo

Ummm Setproperty?
im tryin to change the alpha levels of a movie clip. the problem is that the movie clip im tryin to change is in a totally different .swf that i loaded into the main one where the actionscript is. i want the alpha level of "harleyload" of the harley.swf to be able to be changed by a rollover on the navigation on my main.swf. i have no idea how to do this... and im not a good action scriptor...... so if anybody knows how i can fix this it would be greatly appreciated..... please hook me up.... yahhh



the RoacH

SetProperty Problems
The script is not realizing the value of "menuh"&(counter) (ex: menuh1 = 14). Any idea why?

This is loaded first:

Quote:





// Set up variable to keep track of which menu is being clicked.
menu_num = "0";
menuh1 = "14";
menuh2 = "195";
menuh3 = "245";
stop();






This brings the category UP:

Quote:





counter = menu_num;
while (Number(counter)<3) {
counter = Number(counter)+1;
setProperty("/menu"&(counter), _y, getProperty ( "/menu"&(counter), _y )-"menuh"&(counter));
}






This brings the category DOWN:

Quote:





counter = menu_num;
while (Number(counter)<3) {
counter = Number(counter)+1;
setProperty("/menu"&(counter), _y, getProperty ( "/menu"&(counter), _y )+"menuh"&(counter));
}

Setproperty Quality Please Help
can anyone help me I'm trying to set the quality on a movie clip to Low, but just on a specific movie clip but whe I do the entire swf file gets set to low quality, here is what i have

setProperty("_root.clipone.cliptwo", _quality, "low");

I'm setting this action on a key frame the clip i want with low quality is cliptwo , but whe i use this action the entire swf file gets set to low quality PLease help me

Simple SetProperty ?
What is wrong with this code:

on (release) {
stopDrag();
if (this._droptarget=="/KTe") {
setProperty(this, _x, KTe._x);
setProperty(this, _y, 305);
}

Where:
NKe = MC, movable MC, which should be dropped at:
KTe = MC, droptarget that moves around

I tried so many things, but the only _x-value I can set are straight numbers. But that's no good to me, because the droptarget moves around. So now NKe can be dropped on to KTe, but it won't snap properly into the middle (Sure, it works, but I like things to look good)

Thanks,

Papermouse

SetProperty Not Listening
i am using this code and it doesnt seem to want to do the setProperty part of it, any clues?
function dup() {
duplicateMovieClip(_root.main, "main"+n, n);
setProperty("main"+n, _x, random(100));
setProperty("main"+n, _y, random(100));
}
tnx in advance!
jeff

SetProperty Problem
Hello, I have a problem in a seemingly easy code, I have a movieclip in the main timeline wich I want to control between visible and invisible, on frame one on the main timeline I have a keyframe with this code

setProperty("3lamparas", _visible, "0");

wich renders the mc invisible. Then on frame four there is a stop keyframe.

Then when I want to make it visible from a button 3 levels down (that is: inside a mc(1), inside another mc(rollover-pop button), inside another mc (invisibMC) it does not work, this is the code I am using

on (release) {
setProperty("_root.3lamparas", _visible, "1");
}

but it does not work

please help

Copyright © 2005-08 www.BigResource.com, All rights reserved