Targeting Negative Levels
Is it possible? In creating or loading a movie into pos levels, you just target them like: code: _level100.doSomething(); In negative levels, what would you do? code: -_level99.doSomething() //no _level-99.doSomething(); //ya right
FlashKit > Flash Help > Flash ActionScript
Posted on: 01-30-2004, 12:19 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[levels] Snapto And _levels Targeting Levels
This code is on the root of a movie, it workks fine. However, when i load it into level 100(from another movie) , the snap-to code no longer works.
I've worked with levels a lot, but this really stumps me.
I've tried many many variations to taget the correct path, _levels. _root, this._name, targetPath,
The basic code appear below.
//code on root movie
onEnterFrame = fsnapto;
function fsnapto(){
//trace("pushed @ snapto ==" +choices);
// target1
area_oftarget_x = target1._x;
area_oftarget_y = target1._y;
//target2
area_oftarget_x2 = _root.target2._x;
area_oftarget_y2 = _root.target2._y;
}
// == end snap to==
// code on buttons
on(release){
if(_root.a3._droptarget == "/target1"){
trace("dropped 3================" +this.targetPath);
_root.fchoice("a3");
_root.a3._x= area_oftarget_x;
_root.a3._y= area_oftarget_y;
}
}
++TARGETing Different Levels
Hi,
I would like some help in targeting an external mc.
on (release) {
tellTarget......
-I have a menu in level 4
-The menu loads movies in levels 1,2,3 and 5
- I want that when you clik on a button in the different levels...eg (1) to tell the "menu" to go to frame label "topic2" under _root.pro_menu
Any guidance would be greatly apreciated.
Targeting Levels
Could anybody explain this to me?
When I have my fla file running in flash and I target a function on _level0 this works fine.
But when I run the swf in my browser it doesn't work.
If I use _root for targeting then it doesn't work in flash but it works fine in my browser.
Targeting Levels
Hello,
I have loaded an external swf file at level 10.
At certain points, I want this movie to stop playing...this will be controlled from the base movie....
so what should the code be:
on (release){
_root._level10.gotoAndStop (1)
}
Please help ASAP...thanks a ton
RanTen
Targeting Levels
I am trying to target a specific frame after I have loaded an swf in the main timeline.
Here is the functionality I would like to implement into my FLash project and what I have done so far.
I have three different swf, shell.swf functions as the container where all the other swf are going to be loaded into and is on _level0; then I have testA.swf anf testB.swf each movie has for the moment 3 frames and an MC on each frame.
The whole thing functions more or less as a slide show, so that I have a fwd and back button to move from one frame to the other. When I get on the last frame on testA.swf I have the following script on the fwd button:
on (press) {
unloadMovieNum (1);
loadMovieNum ("testB.swf", 2);
}
So far everything works fine.
The problem occurs when I try to go from the first frame of the new loaded testB.swf to the last frame of testA.swf with the back button.
So far I have tried this, but unsuccessfully. On the back button in frame one of testB.swf I have the following script:
on (press) {
unloadMovieNum (2);
loadMovieNum ("testA.swf", 1);
myFunction();
}
and on the first frame of testb.swf I have:
function myFunction(){
_level1.gotoAndPlay("last");}
stop ();
Any idea what I am doing wrong here?
Targeting Levels
I'm working on a CD project and It involves loading multiple SWFs into levels.
I have one issue that has slowed me down...I think that I need another set of eyes to look at it. Here is a brief description of how the project is layed out:
"level 0" is the interface of the CD..."level1" is the subpage. The problem I'm having now is that the sub page pops up, when the proper button in the interface is clicked...it plays everything on the _root level of the "sub page" timeline, but does not play any of the movie clips within the sub page. I know its because I'm not targeting the levels properly. Here's why:
When the subpage swf is tested on its own, without the interface, it works properly...Its only when I test the interface that the subpage doesn't work...which leads me to believe that I'm not targeting the levels properly. Could someone tell me what I'm doing wrong? Thanks
Here is the script:
_level0._level1.smessage_mc.screen_mc.history_mc.g otoAndPlay(6);
"smessage" is on the root level of Level 1 (sub page). screen_mc is located within smessage_mc...and finally history_mc is within screen_mc.
Targeting Levels
I am attempting to create a dynamic flashsite using levels, however I cannot get my button on a level 10.swf to affect a movieclip with the instance name "logo" on a level3.swf. The .swf loaded into level3 is named btblogo.swf
Here is the code attached to my level 10 button,
on (release) {
tellTarget ("_level3.btblogo.swf.logo") {
gotoAndStop (2);
}
}
Any help would be very much appreciated.
Targeting Levels/movies
I'm sure this sort of question has been asked before, I've searched around and couldn't find any recent post's.
From my main swf movie I load a movie into level1
this movie on level1 loads another movie into level4.
What I would like to do is target an instance of an MC in level1 from a frame in level4.
this instance I want to target is nestled inside other mc's on level1.
also the source of the target on level4 is part of a ifframeloaded action,
eg. if frame is loaded on level4 tell the instance on level1 to goto and stop frame one. then goto scene2 on level4 and play
hope I explained this clearly enough.
appreciate any feedback/help
thanks
Levels, Targeting, And Variables
I have a text box inside of a movie clip on the main level of my movie. Then I have a button inside of a graphic symbol that's inside of a movie clip. This movie clip is also on the main stage. I need the button to load a variable into the text box. How do I target it correctly?
Here is a visual of the hierarchy:
| usbutton
text box | learn buttons graphic symbol
scrolltext | navlearn mc
root/main level
Targeting Scenes In Different Levels?
Heres the problem
i have my main movie. in this movie, i have a button that loads another movie into level 1. in the level 1 movie, i have a button which should unload level 1 and tell level 0 to play a scene called "Additional Services".
Everything works okay, apart from the fact, it doesn't go to the correct scene. it just goes to the first scene of level 0.
Here the Actionscript i am using on the button in level 1:-
on (release) {
unloadMovieNum (1);
tellTarget (_level0) {
gotoAndPlay ("Additional Services", 1);
}
}
Help please.
Thanks in advance.
Mark
Loading Levels And Targeting Them
I have two swfs. content.swf and music.swf(a movie with only an event sound and a preloader)
I need to have music.swf load completely before content.swf begins. When music.swf is loaded I need to have it play as well as I need to have content.swf start playing.
I have tried starting with music.swf and have a loadmovie content.swf into level 1. but I this does let both movies start playing at the same time. One starts before the other unless the movies are cached.
I need to have two separate movies because content.swf contains frame targets where the timeline stops.
Thanks in advance for your help.--JOE
Targeting Levels Is Getting Hairy
I'm working on a CD project and It involves loading multiple SWFs into levels.
I have one issue that has slowed me down...I think that I need another set of eyes to look at it. Here is a brief description of how the project is layed out:
"level 0" is the interface of the CD..."level1" is the subpage. The problem I'm having now is that the sub page pops up, like its supposed to, when the proper button in the interface is clicked...it plays everything on the _root level of the "sub page" timeline, but does not play any of the movie clips within the sub page. I know its because I'm not targeting the levels properly. Here's why:
When the subpage swf is tested on its own, without the interface, it works properly (using the _root property)...Its only when I test the interface that the subpage doesn't work...which leads me to believe that I'm not targeting the levels properly. Could someone tell me what I'm doing wrong? Thanks
Here is the latest script:
_level1.smessage_mc.screen_mc.history_mc.gotoAndPl ay(6);
I've tried this as well:
_root.smessage_mc.screen_mc.history_mc.gotoAndPlay (6);
and I've tried this:
_level0.center_mc.smessage_mc.screen_mc.history_mc .gotoAndPlay(6);
(center_mc, is the host clip for the sub page on level0)
"smessage" is on the root level of Level 1 (sub page). screen_mc is located within smessage_mc...and finally history_mc is within screen_mc.
Questions About Levels And Targeting Them
my layers are "stars" and "spaceship". spaceship is above stars. i copied the instance of the star 100 times. how can i make it so the start appear under the spaceship?
thank you in advance!!!
Help, Problems With Targeting On Levels
What's wrong with my code ?
loadMovie("pages/FADE.swf", 4);
tellTarget (_level4) {
gotoAndPlay("larsklassen");
}
stop();
This isn't working either
loadMovie("pages/FADE.swf", 4);
_level4.gotoAndPlay("LOADER", "larsklassen");
stop();
For some odd reason my action cant find larsklassen which is located in the scene LOADER in FADE.swf
Stuck On Targeting Levels
hi,
i'm trying to target .swfs on levels. I'm having problems making level0 visible after i've made it invisible from a button
which on release ..
on (release) {
_visible = false;
loadMovieNum ("http://www.-/-/index.swf",3);
}
works fine, then on the exit button on level3 ..
on (release) {
_visible = false;
}
but how do i make level0 visible again -
_level0._visible = true; dosn't work & effectivly cancels level 3's script
?? there must be a simple way ..& i dont want to cheat & put backgrounds on
thankyous in advance
stuck
[help]Quick Question About Targeting Levels
Hi, this seems like something that you can do, but I just can't think of how. I am using the MovieClipLoader class, and was thinking it would be easier to load the images into a level, but I want to change the depth dynamically.
My question is how do I then target that level dynamically?
for instance, doing the same thing with a movie clip would like something like this:
_root["mc" + a], now how about with levels?
Targeting Levels... OUCH My Head Hurts
on (release) {
tellTarget (_level19._root) {
gotoAndStop ("home");
}
}
this is the code from a button on level20.... im trying to tell the movie loaded into level19 to goto frame label "home".... its not working
thanks and thanks again =)
HELP
General Targeting On Different Levels / Duplicated Clips
I'm working on a simple game and i need to know if there's a way to target clips that have similar names but are on different levels.
I'm duplicating clips to generate alien space ships and laser/ammo clips and they need to be generated on different levels so that in case of a hit only one can be destroyed.
To detect the collision/hit between the lasers and ships i'm using the 'hitTest' function.
The problems comes when the clips are duplicated and levels are changed. Is there anyway to make the 'hitTest' relative to a group of objects?
Any ideas?
-sup
Targeting Labels On Nonnative Levels (again) URL INCLUDED
Please view the attached link for problem reference
--------------------------------------------------------------------------------------
testsite.gravitysportscanada.com
NOTE: If viewing this site, please choose BIKE option to view problem area.
Targeting Labels On Nonnative Levels (again) URL INCLUDED
Please view the attached link for problem reference
--------------------------------------------------------------------------------------
testsite.gravitysportscanada.com
NOTE: If viewing this site, please choose BIKE option to view problem area.
Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root?
I am in the process of building an application where all of the functions will be eventually exported into seperate AS files. I am having issues with a Sub Navigation that is attached and managed dynamically.
The Sub Navigation is in an MC which contains a mask (which has a tween animation to add a fade in effect), and a blank MC which will contain all of the navigation items.
Upon load of an XML file, the navigation items are extracted and buttons are created within the blank MC. Each button is inserted using the blank MC instance name at the next highest depth.
All of the actions associated with the above need to be issued from the root timeline but when I call the dynamically attached clips (full target path) it cannot seem to find the clips. I have checked the target path numerous times and used a variety of debugging techniques but no luck.
Has anyone else had issued targeting dynamically attached MC's that are nested two - three levels deep?
Thank you so much in advance!
Targeting Dynamically Attached MC's (2-3 Levels Deep) From Root?
I am in the process of building an application where all of the functions will be eventually exported into seperate AS files. I am having issues with a Sub Navigation that is attached and managed dynamically.
The Sub Navigation is in an MC which contains a mask (which has a tween animation to add a fade in effect), and a blank MC which will contain all of the navigation items.
Upon load of an XML file, the navigation items are extracted and buttons are created within the blank MC. Each button is inserted using the blank MC instance name at the next highest depth.
All of the actions associated with the above need to be issued from the root timeline but when I call the dynamically attached clips (full target path) it cannot seem to find the clips. I have checked the target path numerous times and used a variety of debugging techniques but no luck.
Has anyone else had issued targeting dynamically attached MC's that are nested two - three levels deep?
Thank you so much in advance!
Simple GOTO Question (targeting Parent Levels)
Here is my problem:
NOTE: for this example
-MC 1 will be named RED
-MC 2 will be named BLUE
-FRAME LABEL will be named LOOP
I have a movieClip, RED, that plays in the main timeline (level 0). This movie clip, on a "release" action through an embeded button, accesses an embeded movieClip, BLUE, located on level 1. When the movieClip BLUE has finished playing, I would like for the playhead to be redirected back up one level, to movieClip RED. I would also like for it to be directed to a frame label, LOOP, located in the RED movieClip. As it currently stands, BLUE continues to loop, and loop, and loop and loop....
Basically, I need to know how to access frame labels of movieClips located on different levels.
Any and all help is greatly appreciated.
Simple GOTO Question (targeting Parent Levels)
Here is my problem:
NOTE: for this example
-MC 1 will be named RED
-MC 2 will be named BLUE
-FRAME LABEL will be named LOOP
I have a movieClip, RED, that plays in the main timeline (level 0). This movie clip, on a "release" action through an embeded button, accesses an embeded movieClip, BLUE, located on level 1. When the movieClip BLUE has finished playing, I would like for the playhead to be redirected back up one level, to movieClip RED. I would also like for it to be directed to a frame label, LOOP, located in the RED movieClip. As it currently stands, BLUE continues to loop, and loop, and loop and loop....
Basically, I need to know how to access frame labels of movieClips located on different levels.
Any and all help is greatly appreciated.
[F8] Talking About Levels..controling Levels, Loading Swfs Into Levels, Etc
Hello, people!
I have a little tweaking i need to adjust.
To get to the point:
if (1==1)
{
loadMovieNum("test.swf", 3);
_level3.gotoAndStop(10);
}
else (...)
The problem is that on the if cycle, it doesnt consider the level as being loaded. I've tryed a while to wait for the level to load, nothing worked.
I've tested with a button to see if the level exist and is possible to control it and it is, with the onRelase.button etc etc.
Any ideas?
Ricardo
Thanks!
Negative VALUE
i have for example an MC which need to keep going every circle for -1 upward:
TextField Converted as MC(some_mc) under some mask have next code:
_root.some_mc._y -= 1;
//and it going well, but now i want to back clip back when it achieve needed point so i put this:
if(_root.some_mc._y == -745){
_root.some_mc._y = 545;
_root.some_mc._y -= 1;
// it means that i want to back my clip in his starting position and move him again and again, so where i'm wrong? do i maybe have wrong in negative value of clip's position?
Negative Value
i have for example an MC which need to keep going every circle for -1 upward:
TextField Converted as MC(some_mc) under some mask have next code:
_root.some_mc._y -= 1;
//and it going well, but now i want to back clip back when it achieve needed point so i put this:
if(_root.some_mc._y == -745){
_root.some_mc._y = 545;
_root.some_mc._y -= 1;
// it means that i want to back my clip in his starting position and move him again and again, so where i'm wrong? do i maybe have wrong in negative value of clip's position?
Can You Use A Negative X And Y?
I have a movie clip with text in four sections. Need to move it across the screen...(left or right)...based on a button onRelease.
Can I move it to a negative x position?
(No code yet, just wondering before I pull hair out trying to do it.)
Thanks
"Credit belongs to the man who is actually in the arena - T.Roosevelt"
How Come The X Is Negative?
Hey Im trying to fix my movie player and the x is negative in the loader.. that makes everything starts from the middle (where x is 0) look at this picture here even when I load the movie the loader start from the middle and load both right and left. one way to fix this is to put the loader at the x 0 but then I would get white space next to the movie player and I cant find anywhere in the actionscript to change the loader to start from -225 x instead of 0
edit:
Fixed it, when I created the movie clip I had the middle option enabled, Im not sure whats its called. Anyways I changed it to the left side and now it works.
Negative Numbers
its there a quick way to check and see if a varible value is negative
for example
if (var x IS A NEGATIVE NUMBER) {
do this
}
Negative Counter
I have no idea to make a negative counter...
I have tried with GetTimer() but it doesn't work !!
kna someone help me ??
Negative Aceleration For MCs
Hi again,
All my questions from last week (three) were answered promptly, and I thank you in advance for your help.
This one regards decelerating an MC.
To accelerate, for example, you could use the following:
onClipEvent (enterFrame) {
acel=0.5;
speed=speed+acel;
this._x=this._x+speed;
}
How, then, do I decelerate a clip already in motion to a complete stop? Say the speed is this._x=this._x+5, how do I make it stop after decelerating to this._x=0?
Thank you,
Rich
Negative Numbers
Okay, I have the value on my text field as 'i'
I made its default 200 and gave a button the value 'i-150'
If you press the button once then it brings the new value of 'i' down to 50, but if you press it again it goes to 100, then 250, then 400 ect..
My question is how to give the text field a '-' sign when the number is below 0.
Also if theres a way to change the color of the text in the field when the number is below 0.
Any help would be appreciated
Negative Text
Hey all.
I am trying to figure out how to make a negative of some text and a portion of the background behind it. For example, if you have a background thats blue and text on another layer over it while highlighting it with the text tool you will notice what was blue is now a brownish color. I want to mimic that effect without having to re-draw that portion of the background with it's negative colors.
If anyone can help me on this matter i would greatly appreciate it.
Negative To Positive
afternoon peeps
what's the quickest way to convert a negative value to a positive, and vice versa?
my brain is frazzled and i can't think straight...
Positive Or Negative
is there a way to have flash randomly decide if a number is positive or negative?
i want to have an object duplicated randomly and positioned within say 20 pixels of the previous object.
currently i have it generating new objects all over the screen and i want more control.
can someone help?
Negative Image
how can you change the colour of a black movieclip to white whenever it crosses with another black movieclip? so they don't become a big black mass and you can differentiate which is which.
thanks
Negative Or Positive
how do i find if a number is negative or positive or zero
as in sgn(value) = -1 for value = -9
Positive To Negative
Theres' plenty on Flashkit about converting a negative number to a positive one BUT how do you convert a positive number to a negative one?
All I can think of is subtracting its own value x 2....just wondered if there was a more elegant method.
[F8] Countdown Goes Negative
I made a simple working countdown timer using the video tutorial on learnflash.com.
Trouble is, whenever the timer reaches it's target time, it goes down negative.
Code:
this.onEnterFrame = function() {
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var targetDate:Date = new Date(currentYear,4,25);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
var sec = Math.floor(timeLeft/1000);
var min = Math.floor(sec/60);
var hrs = Math.floor(min/60);
var days = Math.floor(hrs/24);
sec = string(sec % 60);
if (sec.length < 2) {
sec = "0" + sec;
}
min = string(min % 60);
if (min.length < 2) {
min = "0" + min;
}
hrs = string(hrs % 24);
if (hrs.length < 2) {
hrs = "0" + hrs;
}
days = string(days);
var counter:String = days + " -" + hrs + ":" + min + ":" + sec;
time_txt.text = counter;
Is there a code to stop the timer once it reaches zero and then display a message like "Time's UP" or something. I've used coding along the lines of
Code:
"if (sec <= 0){
play();
but it doesn't work.
I'm not fluent in Actionscript. Thanks for the help!
Negative To Positive?
Hello,
Im just curious; how would i go about making a negative number positive? For example: 2-3= -1. Instead of my variable holding -1, i want it to just show the difference, or just simply 1. How do i do this?
Thanks in advance =)
Ely
Negative Magnet?
I'm trying to script a sort of negative magnet, I want the force to be stronger when the Mousepointer gets close to the object (a circle) and fade away at a certain distance.
I can't seem to think it out, any ideas?
Negative Numbers
I have a game and I want the score to go negative if they do that badly.
I can get it down to zero with my_score--; but after 0 it starts counting negatively but without the minus sign.
I even tried an if else bit checking to see if it was <0, and then it would add a negative sign, but then it blanks out.
thanks
Rotation Goes Negative
Hello
a question about my problem; Is this normal? And how do i solve this problem?
this is my code:
this.onEnterFrame=rpmrotate;
function rpmrotate()
{
if(instance_six.hitTest(_root._xmouse, _root._ymouse, false))
{
trace(instance_pin._rotation);
if(instance_pin._rotation<=201)
{
instance_pin._rotation +=5;
}
}
}
-----
output of my trace:
163
168
173
178
-177
-172
-167
-162
I would liked it to go up.. and up.. and up.. not negative?!? :-(
Please some help.
Negative Numbers
I am trying to work this out
Code:
obj.pram2=-86.2;
var adjustMask = -170.2-obj.pram2;
trace("adjustMask :"+adjustMask );
output=adjustMask :-84
When I do the Math on a calculator it works out to be -256.4 which is what it should be. Why is this happening.
-170.2 subtract -86.2=negative 256.4
To Enter Negative Value
hello.
i have an input typetextbox on my stage called stakebox.i m using it in my project called matrix.
i want negetive value to be enter by user. but i can't do that ma own... so plz help me...
length of that textbox is 4. i have given some code to that...... i mannaged to enter dot once. but i want minus "-" to enter only one time... any in my text box "-" and "." are covery the length of my text box. i can only write -0.0, but i want - or . to be saperate for the length...
i want the value should be of these format...
let zero be any value..
-0.0;
-.0;
0.0;
................
my code are :
_root._lastLen = _root.stakeBox.text.length;
_root.stakeBox.onChanged = function()
{
var tmp = this.text;
var len = tmp.length; // needed for later use
var carIn = Selection.getCaretIndex(); // for cursor consistency purposes
if(len-_root._lastLen>1) // if paste method is used, and the pasted length is more than 1
{
var firstDot = tmp.indexOf(".");
tmp = tmp.split(".").join("");
this.text = tmp.substring(0, firstDot) + "." + tmp.substring(firstDot);
lenDiff = len - this.text.length;
Selection.setSelection(carIn-lenDiff, carIn-lenDiff);
}
if(tmp.indexOf(".")!=tmp.lastIndexOf(".")) // normal input, or if pasted length is just 1
{
this.text = tmp.substring(0, carIn-1) + tmp.substring(carIn, tmp.length);
Selection.setSelection(carIn-1, carIn-1);
}
_root._lastLen = this.text.length;
}
'Negative' Height ?
Hi
I want to be able to adjust a movie clip's height upwards, without having to change the rotation of the movie clip. Using the tools, ALT + free transform tool does exactly what I am looking for, but the _yscale property in AS scales it both up and downwards and isn't capable of the 'alt' trick, savvy?
Have a look at the illustration below to see what I mean, and of course, I am looking for a way to do this in AS.
Thanks,
Peter
Negative Numbers
I am trying to work this out
Code:
obj.pram2=-86.2;
var adjustMask = -170.2-obj.pram2;
trace("adjustMask :"+adjustMask );
output=adjustMask :-84
When I do the Math on a calculator it works out to be -256.4 which is what it should be. Why is this happening.
-170.2 subtract -86.2=negative 256.4
|