Setting Layers in different levels

Trying to put gradient, between layers

Page 1 of 1

3 Replies - 1966 Views - Last Post: 18 July 2007 - 08:38 AM

#1 bmcc81   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 320
  • Joined: 10-July 07

Setting Layers in different levels

Posted 10 July 2007 - 02:19 PM

What I can't figure out is to get
this.createEmptyMovieClip("maskHolder", -1);
//Which is a mask that is supposed to go between layers and hide the scrolling music players


http://www.redi2play.../testing/dock20 bmcc3 mask.swf

//thats the one with the gradient that I want to fade the players out as well

http://www.redi2play.com/testing/

//This is the original, you can see the difference from the first link
//The files are also inside the testing folder


//--------------------- setting the scene : hides all the un-needed clips -------------------\\

//text fields to hide
this.theText._alpha = 0;
this.theTitle._alpha = 0;
this.userGuide._alpha = 0;
this.theText.autoSize = true;

// creating a container that will hold the mask (THAT HIDES THE SIDES TO THE PLAYER)
this.createEmptyMovieClip("maskHolder", -1);
maskHolder._x = 0;
maskHolder._y = 0;

// creating a container that will hold the mp3 items (scrolling mp3 menu)
this.createEmptyMovieClip("menuHolder", -2);
menuHolder._x = -2164;
menuHolder._y = 355;

// creating a container and loading the flv player inside that container
this.createEmptyMovieClip("playerLoader", this.getNextHighestDepth());

// creating a container and loading the dropDown Menu inside that container
this.createEmptyMovieClip("leftMenuLoader", 3);

// creating a container and loading the upper rigth Menu inside that container
this.createEmptyMovieClip("rightMenuLoader", 6);

// creating a container that will load the playlist scroll Box
this.createEmptyMovieClip("plLoader", this.getNextHighestDepth());

// creating a container that will load any sub Section of the site
this.createEmptyMovieClip("subSectionloader", this.getNextHighestDepth());

var mclListener:Object = new Object();

mclListener.onloadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void
{
_root.loadBar._alpha = 100;
//_root.loadBar.percTXT._visible = true;
var perc:Number = bytesLoaded/bytesTotal;
_root.loadBar.value = perc;
};
mclListener.onloadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
_root.loadBar._alpha = 0;
_root.loadBar.percTXT._visible = false;

trace("new "+target_mc+" loaded ---------- sub visible property = true");

// set the "sub section" visible property to true
subVisible = true;
};


///Thanks for the help

Is This A Good Question/Topic? 0
  • +

Replies To: Setting Layers in different levels

#2 CyanBlue   User is offline

  • D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 156
  • Joined: 01-September 06

Re: Setting Layers in different levels

Posted 12 July 2007 - 06:56 AM

Howdy...

I don't really understand what your question is, but you've got to give positive depth when using createEmptyMovieClip() function rather than -1...
Was This Post Helpful? 0
  • +
  • -

#3 bmcc81   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 320
  • Joined: 10-July 07

Re: Setting Layers in different levels

Posted 17 July 2007 - 10:44 AM

View PostCyanBlue, on 12 Jul, 2007 - 06:56 AM, said:

Howdy...

I don't really understand what your question is, but you've got to give positive depth when using createEmptyMovieClip() function rather than -1...


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hey thanks a bunch for checking out my problem. :D

What I'm not really explaining to well is that when these (player icons) appear they take a long time to show up, especially when its their first time loading.

THESE ARE THE ICONS:
Posted Image

What I want to do is add a loader to it, so that before you see the icons you get a loading bar or something. I don't care even if its just a percent loaded dynamic text box. N e way it could be done would be great.

THIS IS THE EXTERNAL ACTIONSCRIPT FILE:
[CODE]

//---------------------------------------------------------------------------------------------
// parsing the XML of the scrolling menu item players
//---------------------------------------------------------------------------------------------
var xml:XML = new XML();
xml.ignoreWhite = true;


////////* I TRIED USING THIS PEICE OF CODE TO DO IT BUT NOTHING HAPPENS EXCEPT WHAT HAPPENS THE OLD WAY //// NOT WHAT I WANTED *//////////


var profile_xml:XML = new XML();
profile_xml.ignoreWhite=true;
xmlpercent = (profile_xml.getBytesLoaded())/(profile_xml.getBytesTotal())*100
profile_xml.onload = function(success){
if (success){
trace("Yup, it loads")
} else {
trace("Error loading XML file")
}
}
xml.load("icons.xml");


xml.onload = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;



for(var i=0;i<numOfItems;i++)
{
toolText[i] = nodes[i].attributes.tooltip;
playlist[i] = nodes[i].attributes.playlist;
descTitle[i] = nodes[i].attributes.descTitle;
description[i] = nodes[i].attributes.description;
image[i] = nodes[i].attributes.image;
}
_level0.play();
}

//xml.load("icons.xml");

//------------ ON ROLLOVER
function over()
{
var t:MovieClip = this._parent;
var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,.5,true);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,.5,true);
var tiptext = this._parent.toolText;
//tooltip function
expand(tiptext);
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height;
home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
home.tooltip._alpha = 100;
}
//------------ ON ROLLOUT
function out()
{
var t:MovieClip = this._parent;
var tw:Tween = new Tween(t,"_xscale",Bounce.easeOut,t._xscale,75,1,true);
var tw2:Tween = new Tween(t,"_yscale",Bounce.easeOut,t._yscale,75,1,true);
//tooltip function
disappear();
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}

//------------ ON RELEASED
function released(dropDownSelection)
{
tooltip._alpha = 0;
home.titleHolder.unloadMovie("title.swf"); // ( BMCC*81 )
unloadMovie("_level5");

// sets the mp3SelectedOut var to true
mp3SelectedIn = true;
trace("mp3SelectedIn : " + mp3SelectedIn);

//creates a new var with the selection done with the dropdown Menu
var dDown = dropDownSelection;
trace("dDown = "+dDown);

//---- stops the scroll of the mp3 players menu
delete home.menuHolder.onEnterFrame;

for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home.menuHolder["item"+i];

//recording the_x and _y positions for each player
t.xPos = t._x;
t.yPos = t._y;

//setting the_x and _y "selected" coordinates for each player
if(Stage.width < 800)
{
t.destX = ((Stage.width/2 - 301)- (20*(Stage.width/2 - 345)/100) -(home.menuHolder._x));
}
else
{
t.destX = ((Stage.width/2 - 301) - 44.4 -(home.menuHolder._x));
}

//recording _xscale for each player
t.theScale = t._xscale;

//disable all mp3 player item buttons to be clicked
delete t.icon.onRollOver;
delete t.icon.onRollOut;
delete t.icon.onRelease;

if(t != this._parent && t!= dDown)
{
var tw3:Tween = new Tween(t.icon.brightness,"_alpha",Strong.easeOut,0,50,1.5,true);
var tw4:Tween = new Tween(t.r.brightness,"_alpha",Strong.easeOut,0,50,1.5,true);
var tw5:Tween = new Tween(lightOut,"_alpha",Strong.easeOut,0,50,1.5,true);
}
else
{
if(dDown != undefined)
{
selectedItem = dDown;
trace("selectedItem = DropDown selection: "+selectedItem._name);
}
else
{
selectedItem = t;
trace("selectedItem = MP3 Menu selection: "+selectedItem._name);
}

//defines which playlist to load
myPlaylist = t.playlist;

//parse the playlist xml and load myPlaylist inside the flv player
loadPlaylist();

//load and set all the details about the selected player
inPlayerDetail();

myIndic = i;
var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,true);
var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,true);
var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.destX,1,true);
var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,150,1,true);

var s:Object = this;

tw4.onMotionstopped = function()
{
s.onRelease = unReleased;

mp3SelectedIn = false;
trace("mp3SelectedIn = "+mp3SelectedIn);

// sets the mp3PlayerLoaded var to true
mp3PlayerLoaded = true;
trace("mp3PlayerLoaded : " + mp3PlayerLoaded);

invBrowseBack._visible = true;
}
}//end else
}// end for
};

function inPlayerDetail()
{
//---- tooltip is set to transparent
tip._alpha = 0;

// slides in the "view tracks"
if(Stage.width < 800){
var destViewTracks =(Stage.width/2 - 191) - 20*(Stage.width/2 - 345)/100;
}
else
{
var destViewTracks = Stage.width/2 - (191 + 44.4);
}

viewTracks.tween("_x",destViewTracks,.5,"easeInQuad");
viewTracks.alphaTo(100,.5,"easeOutQuad");

theTitle.text = selectedItem.descTitle;
theText.text = selectedItem.description;

theTitle.alphaTo(100,.5,"easeOutQuad");
theText.alphaTo(100,.5,"easeOutQuad");
}

//------------ ON UNRELEASED
function unReleased(whichPlayer)
{
// de-activate the invisible browseBack button
invBrowseBack._visible = false;

// sets the mp3SelectedOut var to true
mp3SelectedOut = true;
trace("mp3SelectedOut : " + mp3SelectedOut);

// delete the onRelease action that was set to call unReleased()
delete this.onRelease;

//unloads all the infos about the mp3 player
outPlayerDetail();

//----- determines which player do we unload
if(whichPlayer == undefined){
whichPlayer = this._parent;
} else {
whichPlayer = home.menuHolder["item"+myIndic];
}

//----- brings all the players back to the scrolling position
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home.menuHolder["item"+i];
if(t != whichPlayer)
{
t.icon.brightness.alphaTo(0,1.5,"easeOutQuad");
t.r.brightness.alphaTo(0,1.5,"easeOutQuad");
lightOut.alphaTo(0,1.5,"easeOutQuad");
home.titleHolder.unloadMovie("title.swf"); // ( BMCC*81 )


}
else
{
t.tween("_xscale",75,1.5,"easeOutQuad");
t.tween("_yscale",75,1.5,"easeOutQuad");
t.tween("_x",t.xPos,1.5,"easeOutQuad");
t.tween("_y",t.yPos,1.5,"easeOutQuad",0,unReleasedEnd);
home.titleHolder.loadMovie("title.swf", "_level10"); // ( BMCC*81 )
}
}
}

function unReleasedEnd()
{
trace("reactivating actions for the button after UNRELEASED");
for(var j = 0; j < numOfItems; j++)
{
var t:MovieClip = home.menuHolder["item"+j];
home.titleHolder.loadMovie("title.swf"); // ( BMCC*81 )
t.icon.onRollOver = Delegate.create(t.icon,over);
t.icon.onRollOut = Delegate.create(t.icon,out);
t.icon.onRelease = Delegate.create(t.icon,released);
}

home.menuHolder.onEnterFrame = mover;

// sets the mp3PlayerLoaded var to false
mp3PlayerLoaded = false;
trace("mp3PlayerLoaded : " + mp3PlayerLoaded);

// sets the mp3SelectedOut var to true
mp3SelectedOut = false;
trace("mp3SelectedOut : " + mp3SelectedOut);

// sets the selectedItem var to undefined
selectedItem = undefined;
trace ("selectedItem = "+selectedItem);
}

function outPlayerDetail()
{
//------- hides buttons for the playlist management
viewTracks.tween("_x",-300,.5,"easeInQuad");
viewTracks.alphaTo(0,.5,"easeOutQuad");

hideTracks.tween("_x",-300,.5,"easeInQuad");
hideTracks.alphaTo(0,.5,"easeOutQuad");

//--------- unloads the playlist swf
plLoader.unloadMovie();

//---- stops any playing sound
playerLoader.ns.pause(true);
playerLoader.ns.seek(0);

//---- switch off the mp3 player
playerLoader.gotoAndStop(39);

//---- makes the Title and Text of the player disappear
theTitle.alphaTo(0,.5,"easeOutQuad");
theText.alphaTo(0,.5,"easeOutQuad");
}

//------------ Moving the tooltip
function moveTip()
{
tooltip._x = _root._xmouse; //this._parent._x;
tooltip._y = 355;
}


//--------------------------------------------------------------------------------------
// FUNCTION TO MAKE THE MP3 MENU SCROLL
//--------------------------------------------------------------------------------------
function mover()
{
if(_ymouse > 250 && _ymouse < 365)
{
var xdist = _xmouse - Stage.width/2;
this._x -= xdist / 25;
}
else
{
if(_xmouse > centerX)
{
this._x -= speed;
}
else
{
this._x += speed;
}
}

if (this._x>= -600)
{
this._x = -1500;
}

if (this._x<= -1501)
{
this._x = -601;
}
//trace("my POsition = "+home.menuHolder._x);
}

//--------------------------------------------------------------------------------------
// FUNCTION TO MAKE THE MP3 MENU DISAPPEAR
//--------------------------------------------------------------------------------------
function explode()
{
// sets the mp3Exploding var to true
mp3Exploding = true;
trace("mp3Exploding : " + mp3Exploding);

//------------------------------------------------------------
//---------- if the menu of mp3 players is visible
if(playerVisible)
{
//stop the scrolling of the menu
// --- if the selectedItem is defined, we are currently viewing a player

if(mp3PlayerLoaded = true && selectedItem!= undefined)
{
// call the function that brings the player back in the menu
unReleased(selectedItem);

this.onEnterFrame = function()
{
trace("----- waiting for the selected player to unload before EXPLOSION ");
if(selectedItem == undefined){
// we are now ready to make all the menu disappear
explosion();
delete this.onEnterFrame;
}
}
}
// --- else the selectedItem is not defined, we are browsing the menu list
else
{
// we are now ready to make all the menu disappear
explosion();
}
}
//------------------------------------------------------------
//---------- else the menu of mp3 players is not visible
else
{
trace("menu of mp3 players is not visible, no explosion necessary !");

// sets the mp3Exploding var to false
mp3Exploding = false;
trace("mp3Exploding : " + mp3Exploding);
}
}

//--------------------------------------------------------------------------------------
// FUNCTION TO REMOVE THE MP3 MENU
//--------------------------------------------------------------------------------------
function explosion()
{
// initalize the counter of MP3
mp3count = 0;

trace("---- deactivating actions for the button while EXPLOSION ------");
for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home.menuHolder["item"+i];

//deactivate the buttons
delete t.icon.onRollOver;
delete t.icon.onRollOut;
delete t.icon.onRelease;

// we store the x and y position for each of the items of the menu
// to be able to bring back all the elements in place when needed.
t.xPos = t._x;
t.yPos = t._y;

// random target position
var tempNB:Number = randRange(0,1);
if(tempNB>0)
{
t.yBoom = tempNB * 1000;
}
else
{ tempNB = -1;
t.yBoom = tempNB * 1000;
}

// tweening all the players to their respective random target
t.tween("_y", t.yBoom, 0.5, "easeOutQuad", 0.05*i);
t.alphaTo(0,0.5,"easeOutExpo", 0.05*i,endExplosion);
}
}

function endExplosion()
{
mp3count++;

// if mp3count = numOfItems, all the players are out of the scene and unvisible,
if(mp3count >= numOfItems)
{
// sets the mp3Exploding var to false
mp3Exploding = false;

//sets the property of the menu to false
playerVisible = false;

trace("player visible : " + playerVisible);
trace("mp3Exploding : " + mp3Exploding);
trace("mp3 items are out of the scene and de-activated");
}
}

//-------- function to randomly choose a NB between 0 and 1
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}

//--------------------------------------------------------------------------------------
// FUNCTION TO BRING BACK THE MP3 SCROLLING MENU
//--------------------------------------------------------------------------------------
function implode()
{
// sets the mp3Imploding var to true
mp3Imploding = true;
trace("mp3Imploding : " + mp3Imploding);

// initalize the counter of MP3
mp3count = 0;

//---------- if the menu of mp3 players is not visible
if(!playerVisible)
{
// brings back the mp3items at their initial state : _y = 0 , _alpha = 100;

for(var i=0;i<numOfItems;i++)
{
var t:MovieClip = home.menuHolder["item"+i];

t.tween("_y", 0, 0.5, "easeInQuad", 0.05*i);
t.alphaTo(100,0.5,"easeInQuad", 0.05*i,mp3ScrollBack);
}
}

//---------- else the menu of mp3 players is already visible
else
{
trace("menu of mp3 players is already visible, no implosion necessary !");

// sets the mp3Imploding var to false;
mp3Imploding = false;
trace("mp3Imploding : " + mp3Imploding);
}
}

function mp3ScrollBack()
{
mp3count++;

// if mp3count = numOfItems, all the players are back on the scene and visible,
if(mp3count >= numOfItems)
{
trace("---- reactivating actions for the button after IMPLOSION ------");

for(var i=0;i<numOfItems;i++)
{
// re-activating all the clicks state on the mp3 items
var t:MovieClip = home.menuHolder["item"+i];

t.icon.onRollOver = Delegate.create(t.icon,over);
t.icon.onRollOut = Delegate.create(t.icon,out);
t.icon.onRelease = Delegate.create(t.icon,released);
}
//sets the property of mp3Imploding to false
mp3Imploding = false;

//sets the property of the menu back to visible
playerVisible = true;

//re-activate the scrolling of the mp3 menu
menuHolder.onEnterFrame = mover;

trace("player visible : " + playerVisible);
trace("mp3Imploding : " + mp3Imploding);
trace("mp3 items are scrolling");
}
}

[CODE/]

Thanking you in advanced
Was This Post Helpful? 0
  • +
  • -

#4 bmcc81   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 320
  • Joined: 10-July 07

Re: Setting Layers in different levels

Posted 18 July 2007 - 08:38 AM

View Postbmcc81, on 10 Jul, 2007 - 02:19 PM, said:

What I can't figure out is to get
this.createEmptyMovieClip("maskHolder", -1);
//Which is a mask that is supposed to go between layers and hide the scrolling music players


http://www.redi2play.../testing/dock20 bmcc3 mask.swf

//thats the one with the gradient that I want to fade the players out as well

http://www.redi2play.com/testing/

//This is the original, you can see the difference from the first link
//The files are also inside the testing folder


//--------------------- setting the scene : hides all the un-needed clips -------------------\\

//text fields to hide
this.theText._alpha = 0;
this.theTitle._alpha = 0;
this.userGuide._alpha = 0;
this.theText.autoSize = true;

// creating a container that will hold the mask (THAT HIDES THE SIDES TO THE PLAYER)
this.createEmptyMovieClip("maskHolder", -1);
maskHolder._x = 0;
maskHolder._y = 0;

// creating a container that will hold the mp3 items (scrolling mp3 menu)
this.createEmptyMovieClip("menuHolder", -2);
menuHolder._x = -2164;
menuHolder._y = 355;

// creating a container and loading the flv player inside that container
this.createEmptyMovieClip("playerLoader", this.getNextHighestDepth());

// creating a container and loading the dropDown Menu inside that container
this.createEmptyMovieClip("leftMenuLoader", 3);

// creating a container and loading the upper rigth Menu inside that container
this.createEmptyMovieClip("rightMenuLoader", 6);

// creating a container that will load the playlist scroll Box
this.createEmptyMovieClip("plLoader", this.getNextHighestDepth());

// creating a container that will load any sub Section of the site
this.createEmptyMovieClip("subSectionloader", this.getNextHighestDepth());

var mclListener:Object = new Object();

mclListener.onloadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void
{
_root.loadBar._alpha = 100;
//_root.loadBar.percTXT._visible = true;
var perc:Number = bytesLoaded/bytesTotal;
_root.loadBar.value = perc;
};
mclListener.onloadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
_root.loadBar._alpha = 0;
_root.loadBar.percTXT._visible = false;

trace("new "+target_mc+" loaded ---------- sub visible property = true");

// set the "sub section" visible property to true
subVisible = true;
};


///Thanks for the help


////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////

I"ve figured out the mask problem, but I still need help on the loader for the (player Icons). If anyone can help me on that one it would be appreciated.

I need to have a loader for before the dynamic scolling (player Icons) show up. I'm not sure on what piece of code needs to be put before I use:
var profile_xml:XML = new XML();
		profile_xml.ignoreWhite=true;
		xmlpercent = (profile_xml.getBytesLoaded())/(profile_xml.getBytesTotal())*100
		profile_xml.onload = function(success){
	if (success){ 
	trace("Yup, it loads")
	} else { 
	trace("Error loading XML file")
		}
		}
	   xml.load("icons.xml");
		



I've added the external actionscript file if anyone cares to take a look.
Thanks
////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1