Problem With Preloader of External SWF

  • jonmathew
  • Newbie
  • Newbie
  • jonmathew
  • Posts: 12

Post 3+ Months Ago

Hello everyone,


I am new to this site as well as flash... I wanted to build a website... so i started doing one... I wanted to have sound with mute button.. I have found out a AS 3 script with Mute facility.. I am giving the code here..


------------------- Code Start ---------------------------------------

var sound = 1;
var slashMC = _root.attachMovie("slash","slash01",99);
slash01._visible = false;
slashMC._y = btn._y;
slashMC._x = btn._x;
var s:Sound = new Sound();
s.attachSound("music");
s.start(0,999);
btn.onPress = function() {
if(sound==1){
s.setVolume(0);
slash01._visible = true;
sound = 0;
}
else if (sound==0){
sound = 1;
slash01._visible = false;
s.setVolume(100);
}
}

---------------------- Code End ---------------------------------------


This code is working fine... The problem is with my next script which is Pre Loader external Content ,which loads my music.swf into the website Here is the code


--------------------- Code Starts -------------------------------------


var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("music.swf"));

function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
}

function done(e:Event):void
{
removeChild(percent); // was removeChildAt(0) but it make more sense this way
percent = null;
addChild(l);
}

---------------------- Code End ---------------------------------------

The preloader is working fine... and loading the music.swf file... But with it Loads ... No Music is there... Can Anyone help me with so that i can use both the codes...............
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.