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




Invoking GetNextHighestDepth() Method



for some reason when i use getNextHighestDepth() when creating multiple TextFields or MovieClips in one wrapper_mc MovieClip it doesn't return the nexth highest depth.


Code:
_root.header_mc.createEmptyMovieClip(mcName, getNextHighestDepth());
_root.header_mc[mcName].createEmptyMovieClip(mcArtName, getNextHighestDepth());
_root.header_mc[mcName][mcArtName].loadMovie(varN.art[1].Url);
_root.header_mc[mcName].createEmptyMovieClip(mcTextName, getNextHighestDepth());
_root.header_mc[mcName][mcTextName].createTextField("title_txt", getNextHighestDepth(), 180, 20, 600, 40);
_root.header_mc[mcName][mcTextName].createTextField("description_txt", getNextHighestDepth(), 380, 60, 400, 80);
_root.header_mc[mcName][mcTextName].createTextField("links_txt", getNextHighestDepth(), 380, 135, 400, 20);
what is going wrong here? i could just add +1 +2 etc. but i'd like to just use getNextHighestDepth() for what it was build for

tnx marijntje



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-11-2006, 08:22 PM


View Complete Forum Thread with Replies

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

EventListener In Class Invoking Method In .fla
Hey all,
I'm just starting in AS3, so forgive my ignorance.

What I'm trying to do is to have a class for dynamically creating units in wargames, the ideas being that this class will be used by multiple games.
However, as each game would have a different result for a particular event, the method associated with that event would need to be in each game's .fla.

For example, I have a Civil War game and a World War 2 game. In the class used by both, there is an addEventListener(MouseEvent.MOUSE_DOWN, checkUnit). In the Civil War game, checkUnit() has the unit check its morale; in the World War 2 game, however, checkUnit() determines the unit's supply.

So, my question is: Can/How does addEventListener located in the Class invoke a method located in an .fla?


Thx

OnEnterFrame Invoking
Hey guys,
I just discovered that you can invoke the onEnterFrame thing without putting it in an onClipEvent. I do have a quick question. If i have a function called raise() that I want to continuously run (it invokes motion) but I only want it to run when I click on a button, how can i do that. I want a button to invoke the continuous function that makes another object move using the onenterframe even handler. I heard you can invoke it using _root.themovieclip.onEnterFrame.raise();. This didnt work fo rme and if anyone can offer some help, i would be greatly appreciative. Thanks again
Don

Function Not Invoking...please Help
Hello

I have a function that works well when i invoke it through onPress, however, the function does not work when i place it in the movie frame.

For instance


function traceMessage(){

trace("I am invoked");
}

works when I invoke like this through a button:

on (press){

traceMessage();
}


However, when I just place the function in the first frame of my movie, like this:

traceMessage();

it doesn't work.

Any suggestions? Thanks,

Tone

Invoking JS Function From .swf/.flv
Hello all

I'm pretty much a novice with Flash, I'm using CS3 and I have a dilemma . I have this one .fla file that has just one keyframe in it and then in the Library window theres an flv file (Name: FLVPlayback Type: Compile).

What I'm trying to do is somehow invoke a function that I've set as a global variable so the flash has access to it after the .flv is done playing.

I've tried adding a blank keyframe after the first keyframe that contains the flv, and if I export that as a .swf it only shows the second keyframe. If I save out just the first keyframe it shows the whole movie.

I would appreciate any help.

Invoking Functions Declared Elsewhere
Hi,

I have this movie which has an #include for a list of functions on the first frame. Sometimes, as required, when loading that movie onto another, it automatically goes to a frame different than the first. But in that case, the functions declared on that #include won't work, as if they never existed in the whole movie (and supposedly they are). The only work around is to repeat the #include in each of the possible frames to skip, but it isn't very practical.

is there a way to make Flash be aware of the functions declared in a previous frame?

The functions in the .as file are all _global, and I'm publishing for player 6, as1.

Thanks in advance,


Sir Patroclo

Reflection For Invoking Methods
I am trying to use Proxy in flash right now for invoking methods. The proxy sits between my remote service and the client. I have another proxy below me, so I would like to do something like the following....

flash_proxy override function callProperty(name:*, ...rest):* {
try {
//popup a window for waiting like the Firefox circle or IE icon
//that moves until the response is received(if it is received that is)

service.{name}(...rest); //I want to invoke the exact same method
//that is passed into this method such that
//I don't have to have a long case
//statement that people forget to fill in
}
catch (e:Error) {
// respond to error here
}
}

naturally the response comes back asyncronously and at that time I would invoke the popup window to close...this way the user interface can't be used while loading remote operations(less bugs that way typically).

thanks for any help on this,
dean

Invoking WebServices With ActionScript 3.0
Hi there,

I am at a point where I need to access some web services to download information from my SWF using AS 3.0. However, I have not been able to find any built-in support for web service invocation and consumption of results in AS 3.0. Am I looking in the right places? (note: I am not familiar with Flex and I am not using it).

So what I did was to build my own HTTP/SOAP request and POSTing it using a URLRequest. That works and I got the results back, however, I was just looking at the results and was wondering if there is some library out there that can help me parse the XML results of the web service call.

Is there any built-in support for calling and parsing web service data for AS 3.0? And if not, any useful tools out there that can make this task easier/simpler? Any help will be appreciated!

Thanks,
- K.

MC Like Button/Invoking Another Mc To Place
Hi - I have a big problem and please help me to solve it. I have moviclip called "b1" which I am using as a button. This b1 is in the shape of switch and when I am clicking on it it turn right and when I'm clicking again the switch is turning left to the primary position. this action is explained by AS code:


Code:
left = true;
b1.onPress = function() {
if(left) {
this.gotoAndPlay(2);
;
left = false;
}else{
this.gotoAndPlay(5);
left = true;
}
}
My problem starts when I want to invoke another movieclip in some place of my scene ( place described by X: and Y: ). I used to invoke clips by this code:


Code:
b1.onRollOver = function ()
{
var klip:MovieClip = this.attachMovie("kwadrat", "kwadrat1", this.getDepth(), {_x: 560, _y:75});
klip.gotoAndPlay(1);
var klipa:MovieClip = this.attachMovie("fkck", "fkck1", this.getNextDepth(), {_x: 489, _y:73});
klipa.gotoAndPlay(1);

}
b1.onRollOut = function() {
this["kwadrat1"].gotoAndPlay(12);
this["fkck1"].removeMovieClip();
};
And only thing which I do is that I have to modernize this AS code for my own requirement. My problem is that I don't have any idea to connect those two codes. My scene ( my menu bar which I was talking about) looks like that:

www.skabszo.alks.info/Untitled-2.html

and please click one of the buttons to see what i am talking about. Sorry for my English but I'm still learning. Best reagards Paul

Invoking Two Dimensional Arrays
I am trying to create a two dimensional array in AS2. It should have two values like name and roll no. and stored in such a manner that they can be traced out and also the corresponding values should be together.

as of now I am using...
myArray1.push({name1:inpName,roll:inpRoll});

trace(myArray1);

not working..please advise

Invoking Google Maps Api With AS
Hi!
I have seen that to retrieve an image form google maps the only thing you have to do is:


ActionScript Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Como integrar Google Maps en tu web</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=TU-API-KEY" type="text/javascript"></script>
 
<script type="text/javascript">
//<![CDATA[
 
function cargar() {
if (GBrowserIsCompatible()) {
var map2 = new GMap2(document.getElementById("map2"));
map2.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}
 
//]]>
</script>
</head>
 
<body onload="cargar()">
<div id="map2" style="width: 500px; height: 300px"></div>
</body>
</html>


my question is:

Is possible to retrieve that image from flash using AS?

greetings!

Polaco

Problem In Invoking Methods
class A {
private var my_movieclip:movieclip;

public function A () {
my_movieclip = _root.attachmovieclip(......);
// the movie clip has a button inside it, named my_button
}
public function B () {
trace("function B");
}
public function C () {
trace("function C");
}
public function D (my_button:string) {
this.mymovieclip[my_button].onPress = function () {
B ();
}
this.mymovieclip[my_button].onRelease = function () {
C ();
}
}
}

I am trying to invoke the two functions B() and C() when the button in the movie clip on press and on release, but unable to invoke the B() and C() functions. Can anybody help me out here in this situation ....
Thanks in advance.

Invoking AS Function From Url In Html Page
I've searched and searched, and I can't find the answer to this one!!

I have a flash movie that works as a glossary. In the movie, each word is defined using asfunction.

I have a website with a page called glossary.htm that contains glossary.swf.

I want to be able to create links from other plain html pages that go to glossary.htm and call a function that I specify in the url so that the word that I want is displayed.

Any help would be appreciated.

Thanks,
Debbie

Simple File Invoking Question
Hi,
I am creating a form using Flash MX. I have couple of fields for the user to enter and when the user clicks submit button then I want to invoke the php script that is written on a seprate file. I am doing the following, but it's not working.
Can anyone help.

on (release)
{
loadVariablesNum ("email.php", "0", "Post");
}

Thanks,
Syed

Invoking Lingo Actions Through Flash
Hi all,

I am using flash 5 and director 8.5 . I want to invoke 'play movie' lingo script (to load another director movie) from a frame on flash timeline.

What actionscript shall I apply?

Regards,

Parag Shah

Invoking Outlook Express From Flash
Hello Everyone:

Need some help with getting flash to open an email window from outlook express.

I've tried using
getURL("mailto:"name@name.com"); attached to a button. From the research I've done this was suppose to open and email window from my default mailer i.e. Outlook Express.

Any suggestions would be appreciated.

Trouble Invoking Actions From External Swf
Hey guys,

Im using the slider menu from kirupa and my question is how do i activate the slider without actually rolling over or clicking the links?

Reason being is that i have shortcut links on other external swfs that i'm calling and i have no problem jumping frames into the appropriate links but slider stays in the original position/link and doesn't move to the appropriate link/page.

Thanks in advance for any help! =)

Event In One Class Invoking Function In Another
Hey all,
I know someone has asked this before, but I can't find the thread.
I have a class setting up an addEventListener:

ActionScript Code:
public function theIndex() {

            for (var a:uint = 0; a < 100; a ++) {
                var tf:TextField = new TextField();
                tf.name =  String(a);
                tf.text = "mytext" +tf.name;
                tf.x = 10;
                tf.y = tf.textHeight * a*10;
                tf.addEventListener(MouseEvent.MOUSE_DOWN,checkChapterS);
                addChild(tf);


            }

        }

with the idea of invoking checkChapterS in the document class. Of course, when I compile it, it says it can't find checkChapterS. How do have the above class call that function which is located in the base class?

Thx

Invoking CFC With CGI.auth_user Doesnt Work
hi



In FlashMX, i want to display the current logged in user. In the CFC i've put the CGI.AUTH_USER. The CFC gets some user info from a database, based on the current user.

When i invoke the CFC from a CMF file, it works very fine.

When i invoke the CFC in a flashmx application, it doen't work. It returns an empty query.

When i use my username in staid of CGI.AUTH_USER, the flash application works fine.

Who can help?

Invoking Outlook Express From Flash
Is this even possible??

Is there a script that will open an email window from outlook express??

The research I've done indictates that the following code attached to a button was suppose to do that.

getURL(mailto:name@name.com);

or is this even possible with flash??

Invoking A Function With The ESC Key In Fullscreen Mode
Hi, I have a movie with a video and when I exit fullscreen mode (pressing ESC) I want to execute a function. I mean, exit fullscreen and execute my function at the same time when pressing 'ESC'

I tried to add a listener but it doesnt work...


Code:
listener = new Object();
listener.onKeyDown =
function() {
if (Key.isDown(Key.ESCAPE)) {myFunction() };
};
Key.addListener(listener);
When I go fullscreen, I press ESC and flash exits fullscreen, but myFunction() doesnt load. If I press ESC a second time myFunction() works.

Is the ESC key blocked in fullscreen mode?

Invoking Outlook Express From Flash
Is this even possible??

Is there a script that will open an email window from outlook express??

The research I've done indictates that the following code attached to a button was suppose to do that.

getURL(mailto:name@name.com);

or is this even possible with flash??

Invoking Flash On Website Problems.
I am totally confused and any help is greatly appreciated. I would like to use a single swf file on all my pages, at the root level it works fine (i.e below is the code from my main index.php page) banner.swf loads its information from mySql and all the required files are in the root/flash folder.

<object classid="clsid:12312" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="875" height="100" >
<param name="movie" value="[color red]flash/banner.swf[/color]" /><param name="allowScriptAccess" value="sameDomain" />
<param name="quality" value="high" /><param name="wmode" value="transparent" />
<embed src="[color red]flash/banner.swf[/color]" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="875" height="100"></embed>
</object>

If I try to call from a lower directory page (root/test/index.php)and change the src="="[color red]../flash/banner.swf[/color" it does not work nor does the direct URL src="="[color red]http://www.site.com/flash/banner.swf[/color" as the value above. I replace all instances of the path in the code.

Thanks in Advance.

Invoking Methods From Variable Names
I'm a bit disappointed in myself that I couldn't come up with the answer to this one.. thanks in advance for your answers.

Here's my actionscript for a button - each frame has a corresponding movie clip called "showmeclip#," with the # corresponding to the frame in the main timeline.

on (release) {
    var currFrame = _level0._currentframe;
    var clipName = "showmeclip" + currFrame;
    clipName.gotoAndPlay(2);
}

Flash does not seem to want to invoke the gotoAndPlay(2) function based on clipName.  Thoughts?

Thanks,
Terwin

Why Does My Button Animate Without Explictly Invoking It ?
I created a user interface with buttons on it that load external swfs.

There are 3 buttons that will load external .swfs but I haven't set that
part of it up yet. I'm stuck on the 1st button.

You can view the .swf at
http://www.jassante.com/charts/starbucks/sbux.html

To view the actual fla file, merely change the "html" to ".fla" minus
the quotes.

I have 2 statements on my actions layer on frame one of the main timeline.

The 1st statement loads an external .swf so that the user
sees a chart as soon as the page loads.

The 2nd statement is a reference to the 1st button who's
instance name is "monthly_mc".

monthly_mc.onRelease = function(){

This is where I invoke the animation of the button (monthly_mc), but since
it's not working right, I took out those statements.
Funny thing is, it's still animating when you mouse over the button
even though there's no code sending the monthly_mc's play
head to a frame label that changes the look of the button (_down). :shock:

}

Can anyone tell me why this is happening ?
Initially, I couldn't seem to click on the button without it changing
states first. I was using onRelease to goto the down state
which uses darker colors on the button's background and stroke.
I also found that I couldn't make the button stay in the down state
after clicking the mouse. It would goto down state when cliking
the mouse, but then revert back to the upstate even though
the statement was a gotoAndStop("_down"). :?:
[/url]

Extracting The Name Of The Swf File Invoking An Action Script
Hi all,
I am building an application where a single action script code is compiled and stored in different names, and based on the name of the swf file invoking the script the script has to do different actions. I need to know is there a way to do this? I mean extracting the name of the swf file invoking the script and inherently use it in the script too, i.e. during run time....
Please help.... this is a big priority for me....

PS: My problem is swfs compiled using the same action script code needs to read different xml files based on the name of the swf file. If u can think of a way to achieve this my problem is solved.

Thanks in advance for all, and please help.
Ajay V

Invoking A Function In A Class On A Mouse Event
hey there folks,

need a little hand, i am trying to activate a function within a class on a mouse rollover -this is AS2 in CS3 and i have the following in my Class.as:


PHP Code:



private function mouseEvents(new_pane, pane_name) {  new_pane[pane_name].onRollOver = function ()   {   movePanes()   this._alpha = 50  }  new_pane[pane_name].onRollOut = function ()   {   this._alpha = 100  }  }  public function movePanes():Void {  var i:Number  for(i in _global.pane_array)  {   trace(_global.pane_array[i])  } } 




the global.pane_array is specified in my FLA
Obviously i would like to see the trace from the array, but nada....
if i put the movePanes() outside the rollover event, it works fine... however this does not achieve my goals

also if i declare the function as a global function from within my FLA, and then call it on the rollover e.g. _global.movePanes() - it works!

I could really use some assistance here as have an imminent deadline approaching...

Many Thanks
nift

GetNextHighestDepth?
I have created an an actionscript, now I need another animation to run on top of it. I have imported the animation to my library as an swf and made it a movie clip, I then put an instance of my movie clip into a new layer on top of the actionscripted layer, giving the movie clip this code:

rec.swapDepths(_root.getNextHighestDepth());

rec is the instance name of my movie clip. I have achieved the correct depth, but now my movie clip does not animate, how can I preserve this animation while keeping it on top of the action scripted layer?

Thanks!~

GetNextHighestDepth Bug?
For some reason, getNextHighestDepth() only wants to work some of the time for me. Many times, for no reason it wil give my MC a negative depth value...usually inthe negative 16,000 range. Anyone ever see this before? What doesn this mean? Could this be just another effect of global warming?

GetNextHighestDepth Bug? Help
how do i delete this

GetNextHighestDepth
Hi,

I wonder why a movieclip is still visible in the next frame, when it has been given the getNextHighestDepth?
For instance with:

Code:
mc.onPress = function() { mc.swapDepths(this.getNextHighestDepth()); mc.startDrag(); }; mc.onRelease = function() { stopDrag(); }; stop();
on the first frame, and then when the movie goes to the next frame the mc is still there.

How come?

thank you,

Jerryj.

Going Above GetNextHighestDepth
I'm loading a component findDrop.swf using this code

_root.createEmptyMovieClip("empty",_root.getNextHi ghestDepth());
empty._lockroot = true;
empty._x = 275;
empty._y = 102;
empty.loadMovie("findDrop.swf");

this is on the top level.

How do i get an existing MC object in the same main movie to sit above this dynamically generated MC?

Cheers Rat

GetNextHighestDepth()
I've been using getNextHighestDepth to place new mc's in my game
Unfortunately, I want these to come in underneath other movie clips, and I just found that getNextHighestDepth just returns a depth higher than the highest, rather than returning the lowest available depth. Is there a function that does that instead?

ex:

I have depths 0, 1, 2, 3, 5, 100, and 101 occupied. I need a function that will return 4.


I was thinking, to avoid all of this, I could put the mc's that I need on the top into a higher level, but from what I understand, you can only use levels when loading an external movie?

Help With GetNextHighestDepth
I am making a game with zombies that keep coming through a door. when they have entered the door I a using a hit test so they don't walk through the walls. the problem is I am using

Code:
for (i=0; i<_root.myGuy.numZ; i++) {
this.attachMovie("zombieHolder", "holder"+i, this.getNextHighestDepth());
}
to generate the zombies. so the zombies are not hitting the walls that are at a lower depth. does any one know how to fix this?

Help With GetNextHighestDepth()...
on (release) {
container1.attachMovie("pic2","newname1",container 1.getNextHighestDepth());
}

This is on a button within a movieclip that is part of an infinite menu of pics. The container1 movieclip is on the main stage. It is not working...pic1 is linked and all that, so I'm not sure what's wrong.

HELP!

GetNextHighestDepth()
Yes, I know it's not AS2.
That's why I am asking...

What would I use instead?
I want to attach a movie with AS, but it has to be infront of the movie it's being attached to... or attached to the front.

I have used "bring to front" before but I remember it slowed down my interface.

So what do I use???

GetNextHighestDepth()
Code:
//_quality = "LOW";

import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.None;


//define number of layer.
var layer = 20;
//number of items in a layer
var items = 4;
//create the bg that holds the layers
this.createEmptyMovieClip("bgHolder", this.getNextHighestDepth());
//this function will update the layers current position
function updateMovies() {
//easingStrenth
d = 5;
this.x = _root._xmouse;
this.y = _root._ymouse;
//get the linear relation fo x.
var coef = (Stage.width-this._width)/Stage.width;
//update x with easing.
this._x -= (this._x-coef*this.x)/d;
//get the linear relation fo y.
coef = (Stage.height-this._height)/Stage.height;
//update y with easing.
this._y -= (this._y-coef*this.y)/d;
}
//init function for the layers
function init() {
for (i=0; i<layer; i++) {
//create a layer
var temp = this.bgHolder.createEmptyMovieClip("bg"+i, this.bgHolder.getNextHighestDepth());
depth = temp.getNextHighestDepth();
//create a virtual bag for the layer to define it height and width.
virtual_mc = temp.attachMovie("virtual", "vitrual"+depth, depth, {_visible:false, _width:(i)*Stage.width/4, _height:(i)*Stage.height/4});
//put the items into the layer
for (j=0; j<items; j++) {

for(a=1;a<=8;a++){
theHigh = _root["float"+a];
theHigh.thisNum = a ;


depth = temp.getNextHighestDepth();

//attach an item
var theHigh = temp.attachMovie("float"+a, "float"+depth, depth);
//position it randomly in the current layer
theHigh._x = Math.random()*(i+2)*Stage.width;
theHigh._y = Math.random()*(i+2)*Stage.height;
theHigh._rotation = Math.random()*Stage.height;
//scale it randomly
rand = Math.random();
theHigh._xscale *= .5+rand;
theHigh._yscale *= .5+rand;
//put is opacity randomly
//theHigh._alpha = random(80)+50;
//blur
var blur:BlurFilter = new BlurFilter(1*Math.random(), 1*Math.random(), 1*Math.random());
for (var b:Number=0; ++b<=6; ) theHigh.filters = [blur];
}
//each layer share the same updating function.
temp.onEnterFrame = this.updateMovies;
}
}
}
init();
I am having problems to place on the highest level the cursor which was created for my mouse.

Looking to the code I can image why this is happening. The code is creating and duplicating layers of MCs, placing it over (in a highest level) the previous one.


Code:
onClipEvent (load){
Mouse.hide();
}
onClipEvent (mouseMove) {
setProperty (this, _x, _root._xmouse);
setProperty (this, _y, _root._ymouse);

this.getNextHighestDepth()

updateAfterEvent(mouseMove);
}
For the cursor I have this code.

Even placing this.getNextHighestDepth() the cursor will be under the duplicated layers.

How can I control the level of these duplicated layers and place any MC over it? Ahh, and reminding that I need to keep the loop.

Cheers,
Diego

GetNextHighestDepth
Okay, I posted this problem a while ago, but thought I had a solution. It works sometimes, but not all the time. I have made a drawing application, and whatever you draw is drawn using getnextHighestDepth, so its always on top. Now, I am using custom cursors I made, and when you draw a shape, the cursor goes behind whatever you draw. So this is what I tried:

_root.createEmptyMovieClip("Cursor", getNextHighestDepth());
_root["Cursor"].swapDepths(_root["paintBrushCursor"]);
removeMovieClip(_root["Cursor"]);

Now, this kind of works, sometimes. What I was hoping it would do is create an empty movie clip after the shape has been created, then swap the cursor with the cursor (which should be at the highest depth), so it would be on top, then delete that movieclip. So the next time they make something, it makes another empty movie clip to swap, thn deletes it as well. What happens you make a shape, and the cursor stays behind, but you make another and it appears on top, then you make another and it appears behind again, etc. Any idea how I'd make this work, so the cursor always stays at the highest depth?

Help With Xml And GetNextHighestDepth
I have a thumbnail gallery that is called in with xml- On stage is a movieClip that covers the entire thumbnail area with the alpha set to 0. what I'm trying to do is onRelease- have that mc brought to the front and it's alpha state tween to 100- i've not much experience using 'getNextHighestDepth' so I'm assuming something is wrong here... if anyone can help I'd really appreciate it!
Thanks!









Attach Code

target_mc.onRelease = function() {
stageFade_mc.getNextHighestDepth();
TweenLite.to(stageFade_mc, 3, {_alpha:100});
loadMovieNum(view[p], 5);
};

GetNextHighestDepth
Hello,

I am having a small problem with the getNextHighestDepth function. I have multiple movie clips on stage (a deck of cards). Clicking on any movie clip will start dragging it, and bring it to the top of the pile. Problem is, I can click a card near the bottom of the deck, it will come to the top fine, but other mc's will also come forward in front of others in the pile. Why does this happen?

Here's my code for a couple of the cards...







Attach Code

cardFilingCabinet_mc.onPress = function() {
cardFilingCabinet_mc.swapDepths(this.getNextHighestDepth());
startDrag(this);
};

cardFilingCabinet_mc.onRelease = function() {
stopDrag();
};

cardAccountant_mc.onPress = function() {
cardAccountant_mc.swapDepths(this.getNextHighestDepth());
startDrag(this);
};

cardAccountant_mc.onRelease = function() {
stopDrag();
};

cardArchitect_mc.onPress = function() {
cardArchitect_mc.swapDepths(this.getNextHighestDepth());
startDrag(this);
};

cardArchitect_mc.onRelease = function() {
stopDrag();
};

GetNextHighestDepth
Hello,

I need some guidance on getting getNextHighestDepth to work for my file. I have a deck of cards that I want the user to be able to flip through. When the user clicks on a card, it flips over. I have tried using
myCard.onRelease=function(){
this.getNextHighestDepth();
}

I'm wondering if I need to dynamically place instances of myCard onto the stage to get this to work, or if all my cards can be placed on the same layer on the main timeline, and they can be controlled from there.

Here are my swf and fla files.

Any help greatly appreciated. If you look at the files, you will see that they are somewhat complex with the way they are set up to animate properly. This, I think, is what's confusing me when it comes to writing my code so that it affects the proper place.

Cheers,

P





























Edited: 01/22/2008 at 08:50:59 AM by Mister Peanut

GetNextHighestDepth
Hi there ... I want to createEmptyMovieClip in the next free level, I remember it was something with getNextHighestDepth?

How do I actually do this ?

GetNextHighestDepth?
Here is some simple code I am using to try to put two yellow blocks on the screen. I can't seem to get the getNextHighestDepth function to work. What am I doing wrong here? I have tried using this.getNextHighestDepth() and _root.getNextHighestDepth(); If I use the blocks number which increments, both show up so they are on different depths, but I'd like to use the automatic number.
How do I use this function?


Code:
Block = function(shape,x,y){
this.shape = shape;
this.clip = _root.attachMovie(shape, "block_"+_root.blocks, this.getNextHighestDepth());
this.clip._x = x;
this.clip._y = y;
_root.blocks++;
trace(this.clip);
trace(this.clip._depth);
};
blocks = 1;
b = new Block("block",0,0);
b = new Block("block",35,0);
Output:
_level0.block_1
undefined
_level0.block_2
undefined

No More GetNextHighestDepth() In As3, And Now What ?
Hello,

I have an addChild(mc) and an addChild(bitmap), what happens is that the bitmap stays above the movieClip, hiding it. What can I do to solve the problem?

I can't find the solution.


Thanks in advance.

GetNextHighestDepth
Hi

I followed the XML drop down tutorial and managed to get the system working fine, however when I have applied this method to my own project I have found a problem.

The original tutorial uses a depth of 0 when creating the menu item:

var curr_menu = container.createEmptyMovieClip(name, depth);

This means the menu items were being placed under another movieclip which is being created programmatically.

My solution was to replace the original depth with getNextHighestDepth:
var curr_menu = container.createEmptyMovieClip(name, this.getNextHighestDepth());

This appeared to work fine,the menu now appeareed above the other movieclip, until I realised the menu rollovers wouldn't work after loading the menu a number of times (I load the menu onRelease of a button).

Any help would be much appreciated.

Scott

GetNextHighestDepth
Hi there ... I want to createEmptyMovieClip in the next free level, I remember it was something with getNextHighestDepth?

How do I actually do this ?

Function In A Method Return True To Method's Caller?
I think I probably don't know the correct terminology to ask this question, but here goes:

In this example, can anyone tell me how to have the setComplete event function within the main method return true to the caller of the method, instead of just to the listener?


PHP Code:



    function loadAsset(target:MovieClip, asset:String, assetLoaderInfo:LoaderInfo): Boolean    {    var assetLoader:Loader = new Loader();    var assetURLRequest:URLRequest = new URLRequest(asset);    assetLoader.contentLoaderInfo.addEventListener(Event.OPEN, setLoaderInfo);    assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, setComplete);    function setLoaderInfo(event:Event)        {        assetLoaderInfo = event.currentTarget;        }    function setComplete(event:Event)        {        target.addChild(assetLoader);        return true;        }    assetLoader.load(assetURLRequest);    }

Function In A Method Return True To Method's Caller?
I think I probably don't know the correct terminology to ask this question, but here goes:

In this example, can anyone tell me how to have the setComplete event function within the main method return true to the caller of the method, instead of just to the listener within the method?

Many thanks!


PHP Code:



function loadAsset(target:MovieClip, asset:String, assetLoaderInfo:LoaderInfo): Boolean
    {
    var assetLoader:Loader = new Loader();
    var assetURLRequest:URLRequest = new URLRequest(asset);
    assetLoader.contentLoaderInfo.addEventListener(Event.OPEN, setLoaderInfo);
    assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, setComplete);
    function setLoaderInfo(event:Event)
        {
        assetLoaderInfo = event.currentTarget;
        }
    function setComplete(event:Event)
        {
        target.addChild(assetLoader);
        return true;
        }
    assetLoader.load(assetURLRequest);

    }

GetNextHighestDepth Problem
Hi
I am dynamically loading images from a database..three different rows for three different queries.. i can see all the images load but then a couple will dissapear becuase they are in line with images on a different row... to make more sense ive created a mock up version with a couple of images and text file as the dynamic part..

it can be download @
http://www.geocities.com/mrsigma/FlashStore.zip

Any help would be greatly appreciated.

GetNextHighestDepth() Function
I just trying to simply place two instances of the same movie clip (circle) onto my home section of the site and the getNextHighestDepth() is messing me up. When I use it, only the second instace (cirB) shows up. I thought this function was supposed to make sur nothing is on the same level? When I add a depth area to the function and then put 1 and 2 in each of the areas where I call the function, it works. But this is unnecessary hard coding.

code:

var r = _root;
w = Stage.width;
h = Stage.height;
var highestDepth = 0;
Stage.scaleMode = "showAll";
var ballFade = true;
var swigleFade = true;
dep = _root.getNextHighestDepth();
//-------------------------------
r.createEmptyMovieClip("home", getNextHighestDepth());
//--------

function fadeCircle(originalitem,newitem,xpos,ypos,opacity)
{
home.attachMovie(originalitem,newitem, dep);
home[newitem]._x = xpos;
home[newitem]._y = ypos;
//home[newitem]._alpha = 0;
//if (home[newitem]._alpha <= 100)
//{home[newitem]._alpha += opacity
//}
}//end function

//--------------------------------------------------
home.onEnterFrame = function()
{ var cirGap = 40;
if (ballFade == true)
{
fadeCircle ("circle","cirA", 150, 250, 10);
fadeCircle ("circle","cirB", 20, 50, 10);
}// end if
}// end on enter frame

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