Jump to content
GreenSock

toti86

Load swf

Recommended Posts

Hi all

 

I am beginer so dont be hard 8-)

 

I have As3 file, with which I use loadermax class. At begiining of main.as i have something like

 

1 question

 

var queue:LoaderMax = new LoaderMax({name:"mainQueue", noCache : true, estimatedBytes:250000, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
queue.append( new SelfLoader(this) );
queue.append( new SWFLoader("index1.swf", {name:"childClip", noCache : true, estimatedBytes:100000, container:pozadina }) );
queue.load();

 

functons progressHandler, completeHandler, errorHandler are also defined and everthing works fine...

 

later in site user can choose some options and depend on which button he click he must load new swf movie in container

 

var loader:Loader = new Loader();
  addChild(loader);
loader.load(new URLRequest("mp3kvizmain/mp3kvizzabavna.swf"));

 

I what to insert loader max here (not to use flash load function) but dont now how, and prevent caching of that file. I dont want to load that swf file at begining because maybe user dont chose that file (button) there are 9 others...

 

2 question

 

its not about loader more about tweening. I want to add some nice tween animations, when user clicks on button than window with text open and for closing that windows too.

 

Now I use only visible = false or true

 

For exapmple like win7 efect when open new window.

 

Can anyone point me, for solutions

 

Tnx for the GS it realy helps!

Link to comment
Share on other sites

if your end goal is to simply use a SWFLoader to accomplish the task of loading a swf, just do:

 

var mySwf:SWFLoader("mp3kvizmain/mp3kvizzabavna.swf", {container:this, noCache:true});
mySwf.load();

 

i'm not sure what you want to use as a containers so i just used "this". you have already loaded 2 swfs so I'm sort of at a loss for what information you need.

 

as for your 2nd question, I'm sorry but it is kind of vague. Don't really know how to suggest a solution. I haven't used win7 much, but I imagine you want to use a tween that modifies the scaleX, scaleY, and possibly rotationY for the 3D effect.

 

something like

 

TweenMax.from(window_mc, 1, {scaleX:.2, scaleY:.2, rotationY:-90});

 

might be a good starting point. not sure.

Link to comment
Share on other sites

tnx for the answers but no luck

 

for 1 st :

 

I modified litle your code to

var mySwf = new SWFLoader("mp3kvizmain/mp3kvizzabavna.swf", {container:loader,noCache:true})
	    mySwf.load();

 

but compiler give mi error when I try to click on button

 

 

Error: Error #2069: The Loader class does not implement this method.

at Error$/throwError()

at flash.display::Loader/addChild()

at com.greensock.loading.display::ContentDisplay/set loader()

at com.greensock.loading.display::ContentDisplay()

at com.greensock.loading.core::DisplayObjectLoader()

at com.greensock.loading::SWFLoader()

at Main/playzabavna()

 

I pusted whole function so u might better understand :)

 

 function playzabavna(event:MouseEvent):void {


  var loader:Loader = new Loader();
  addChild(loader);

  var dugme:Loader = new Loader();
  addChild(dugme);


 var zatvoriAS2:Function = function():void {
   removeChild(loader);
   removeChild(dugme);

   SoundMixer.stopAll()
   zabavna.visible  = true;
   strana.visible  = true;
		    narodna.visible = true;
		 mc_photo.visible = true;
		 mc_buy.visible = true;

		 pozadina.visible  = true;
		 pomoc.visible  = true;
   mp3pomocni.visible  = true;
   nereg.visible = true
   login.visible  = true

  }

  zabavna.visible  = false
	    strana.visible  = false
	    narodna.visible = false
	    mc_photo.visible = false
	    mc_buy.visible = false
	    domacaopen.visible = false
  stranaopen.visible = false
  allopen.visible = false
	    pozadina.visible  = false
	    pomoc.visible  = false
	    mp3pomocni.visible  = false
  nereg.visible = false
  login.visible  = false

  var mySwf = new SWFLoader("mp3kvizmain/mp3kvizzabavna.swf", {container:loader,noCache:true})
	    mySwf.load();



  //loader.load(new URLRequest("mp3kvizmain/mp3kvizzabavna.swf"));


  dugme.x = 740; dugme.y = 375;
  dugme.load(new URLRequest("mp3kvizmain/dugme.swf"));

  TweenMax.from(dugme,0.7,{autoAlpha:0, delay:4.75});

  dugme.addEventListener(MouseEvent.CLICK,zatvoriAS2)



  //var pausePosition:int = mySound.position;
	   //mySound.stop();

    //  mySound.Stop()

  SoundMixer.stopAll()

 }

 

 

for the second question yea its hard to me to explain in my own language what I want

 

with that code flash give me an error

 

Line 87 1118: Implicit coercion of a value with static type Object to a possibly unrelated type Number.

and

 

Line 87 1136: Incorrect number of arguments. Expected 3.

 

I need something like this

 

 

for minimizing and opening windows, but dont now is it possible

 

Tnx for help

cheers

Link to comment
Share on other sites

it appears you are trying to place your SWFLoader's content into a regular Loader object.

 

 


var loader:Loader = new Loader();
addChild(loader);
var mySwf = new SWFLoader("mp3kvizmain/mp3kvizzabavna.swf", {container:loader,noCache:true})

 

the Loader is not allowing you to perform an addChild()

you should just use a movie clip or sprite as the container, not a Loader.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×