Jump to content


Photo

Movie clip link


  • Please log in to reply
15 replies to this topic

#1 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 24 May 2007 - 04:18 PM

Hello,

I am fairly new to flash and I am using a template for a website. I have a movieclip menu (Home, About Us etc.) and I want to link each one to a new page but I cannot seem to figure out how to do it. Furthermore, I'd like to link it so it shows up on a certain part of the same page. Any help would be greatly appreciated.

#2 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 24 May 2007 - 09:21 PM

Are these separate content sections in their own swfs? One option is to create a holder clip that sits where you want the content to show up, and then use a movieclip loader to load the swf into that holder clip. This works well because your site wont preload the content that might not get viewed. Saves on bandwidth and initial wait time. I have a tutorial on the movieclip loader class on my website that includes code for a progress bar as well. Give it a look if you decide to use external swfs for content.

#3 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 24 May 2007 - 10:53 PM

Are these separate content sections in their own swfs? One option is to create a holder clip that sits where you want the content to show up, and then use a movieclip loader to load the swf into that holder clip. This works well because your site wont preload the content that might not get viewed. Saves on bandwidth and initial wait time. I have a tutorial on the movieclip loader class on my website that includes code for a progress bar as well. Give it a look if you decide to use external swfs for content.


Thank you for the response. I will be a little more precise. I am a video editor and I have many sample videos I want to put on my site. I have changed the wmv and mpeg files into flash videos already so I can use them on my site. The menu is on the right side and I want the link to the page clicked on the menu to appear on the left side in say a rectangle. I want to be able to have all the links (Home, About us etc) show up in the same rectangle when clicked. I don't even know how to create a holding clip...I may have gotten in a little deep straying away from my video editing and venturing into Flash lol. Any help would be appreciated. Thanks again.

Edited by a41ramo, 24 May 2007 - 10:56 PM.


#4 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 25 May 2007 - 11:32 AM

Flash isnt too far off from video editing...you have a timeline and you have different elements. And then you have your actionscript.

Quick tip for actionscript -> pretty much anything you'd like to refer to using code, you need to give it an instance name.

To make the holder clip, create a new movieclip (Shift + F8) and give it a name (this name is NOT the instance name!). Put this holder clip on the stage where you would like your pages to appear.

Give the holder clip an instance name. To do this, click the element on the stage, go to the properties tab, and enter the instance name in the text field there.

Now things will get more complicated. You'll need to make your nav buttons into movieclips so you can click em and whatnot. Button elements in flash are a bit simpler, but deprecated.

With your first button, make a new layer inside it, and on the first frame of that new layer put the code:
this.onRelease = function(){
_parent.loaderFunc("mySwfName.swf");
}

The onRelease is an event. Basically saying "on the release of this object, do the code in the { }".

The _parent makes the movieclip refer to the timeline it is on. So if you made your entire swf on Scene 1 (the root timeline) thats what _parent would be. The more _parent's you add the higher up the timeline hierarchy it goes. Just remember to use dot notation to add more _parent's on (ie: _parent._parent.functionName()).

The loaderFunc("mySwfName.swf"); portion is calling a function called loaderFunc on the parent timeline. This means you need to create a new layer on the parent timeline for your actionscript, and on the first frame, make a function called loaderFunc. The "mySwfName.swf" is a string containing the url to the swf you want to play. A good idea for this (since you might be loading in flv's) is to embed those flvs into a swf and load up that swf. Saves loading time, and itll take you less time to publish your main movie not having them embedded.

function loaderFunc(targetToLoad:String){
//put code from tutorial in here.
}

In the movieclip loader tutorial, itll give you the code to use, however it will need to be edited. Rather than loading up a gif (i think thats what I used in the tutorial) just put the variabe "targetToLoad" there. That should get you started. Post back if you need more help...I'll be away for the weekend and if nobody else gives you a hand before I get back, I'll continue helping you then.

Good luck

#5 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 25 May 2007 - 07:48 PM

I think I may just call it good... I tried but I couldn't seem to get it even close to working. I put the actionscript in for the button and I don't know if I should've put the entire tutorial actionscript in for the parent or not but I tried both ways. I changed all the info that needed to be changed but it does nothing when I click the button. I figured it'd be easier by getting a template but I am just lost when it comes to this. Changing the text was easy though lol.

#6 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 26 May 2007 - 07:40 PM

If you post some of your code/an fla on here, I'm sure either I or someone else could have a quick look. Setting up navigation is a fairly quick task once you understand it all.

#7 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 26 May 2007 - 09:49 PM

Ok, here goes... Excuse my noobiness. I followed your tutorial and created the
new loader_mc, but I couldn't seem to find out how to give that an instance
name as there was no option. I used the actions you said to use on scene1
and added the actions to the button you told me to use in your post. I still
can't seem to get it to work. I imported an image called step2.gif for convenience.
Here is the code and a screenshot of the errors it gave. I will upload an FLA
if this does not help.

Scene1 actions:

this.onRelease = function(){_parent.loaderFunc("mySwfName.swf");}// Stop action to prevent the playhead from moving on.stop();// Import classes for tweeningimport mx.transitions.Tween;import mx.transitions.easing.*;// Declare the listener objectvar oListener:Object = new Object();/* Assign a value to "r" for root. Functions executedfrom an object (like we will be doing) lose the scopeof 'this'. I prefer using 'this' rather than '_root'because if I were to bring this code into another .fla,I would not be able to garuntee that '_root' will be whatI need it to be. It is also helpful to assign values forthe loader_mc, and the textfield inside the loader.*/oListener.r = this;oListener.loaderMc = this.loader_mc;oListener.loaderTxt = this.loader_mc.loader_txt;oListener.gradMc = this.loader_mc.grad_mc;oListener.borderMc = this.loader_mc.border_mc;/* Assign a function to the first event to listen foronLoadStart gets broadcast by the movieclip loaderwhen the specified has begun to be loaded.*/oListener.onLoadStart = function(targetMC:MovieClip):Void{// For information on what this tween means, check out the tutorial on tweening.// at www.SanctifiedStudios.comvar loadAlphaTween:Tween = new Tween(this.loaderMc, "_alpha", Strong.easeOut, 0, 100, 2, true);}/* onLoadProgress gets broadcast by the movieclip loaderwhen download progress has been made on the target.*/oListener.onLoadProgress = function(targetMC:MovieClip, nLBytes:Number, nTBytes:Number):Void{// nLBytes is loaded bytes, nTBytes is total bytes to be loaded./* Declare a new variable nPer (the n is the variable type. n is for Number) the Perstands for percent.To find the percent loaded, you need to divide the loaded bytes by the total bytes.We then need to multiply it by 100, becuase this will return a decimal value. Tofinish it off, we round it. This prevents us from getting large ammounts of decimalplaces.*/var nPer:Number = Math.round((nLBytes/nTBytes)*100);// This refers to the oListener object, where we assigned the values for the loader mc// as well as the textfield that we had in the loader.this.loaderTxt.text = nPer + "%"; // With the % sign./* remove this line to remove the % sign on your loaderthis.loaderTxt.text = nPer; // Without the % sign.remove this line as well*//* Time to move the gradient up!The Math:The _y property is the y axis (up and down) value."this.borderMc._height * (nPer/100)"This line finds the relative location to put the gradient clip.So if the loader has loaded 50%, it would find the pixel at the 50% point of theloader circle. For example, if our loader is 80 pixels high, and 43% of the targethas been loaded, we would put the gradient at 80 * (43/100), which = 34.4We add the "this.borderMc._height - " to the start of the equation to make thegradient appear at the bottom and move up. Without that part on the start of the codethe gradient will move from the top down.*/this.gradMc._y = this.borderMc._height - (this.borderMc._height * (nPer/100));}/* The final event to listen for is the onLoadInit. This is when the itemhas been fully loaded and initialized on the stage.*/oListener.onLoadInit = function(targetMC:MovieClip):Void{// Just some animations to get rid of the loader and transition the image onvar loaderTween:Tween = new Tween(this.loaderMc, "_alpha", Strong.easeOut, 100, 0, 1.5, true);var targetTween:Tween = new Tween(targetMC, "_alpha", Strong.easeOut, 0, 100, 1.5, true);}/* Create the moviecliploader variable */var mcl:MovieClipLoader = new MovieClipLoader();/* Assign the listener we made above to the moviecliploader. When the mcl broadcasts eventsthe listener will now pick them up and react.*/mcl.addListener(oListener);/* Create a new movieclip to load the image into, and then tell the mcl to load an image.The first parameter is the path to what you are loading, the second is the target mcto load into. Example: mcl.loadClip(path, target_toLoadIn);*/this.createEmptyMovieClip("imageHolder_mc", this.getNextHighestDepth()); // creates an empty mc// step2.gif is an image I have local to my fla. Replace this with any image you desire.// The mc we just made above will be our target. It resides at 0,0 on the stage by default.mcl.loadClip("step2.gif", this.imageHolder_mc);

Button actions:

[/b]this.onRelease = function(){<BR>_parent.loaderFunc("mySwfName.swf");<BR>}[b]

Errors:
Posted Image

Edited by a41ramo, 26 May 2007 - 09:54 PM.


#8 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 27 May 2007 - 12:00 PM

Here is an example using the .fla from the tutorial. I just added a button in. Check the code on the button, very simple.

Attached Files

  • Attached File  mcl.zip   8.16KB   60 downloads


#9 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 27 May 2007 - 10:00 PM

I see what you mean now. Thank you for the help. I appreciate it greatly. It seems to work with a hosted image but I uploaded an FLV to my FTP and it doesn't seem to show up. Any ideas?

#10 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 28 May 2007 - 08:11 AM

Easy fix for that is to embed the flv into a swf, then load the swf.

#11 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 30 May 2007 - 04:11 PM

Easy fix for that is to embed the flv into a swf, then load the swf.


It just seems to load so slow when I embed it. Last question I hope and BTW I appreciate your help more than you know, thank you. I can't seem to import the video because the template I have is in actionscript 1.0 and it needs actionscript 3.0 to do this. Any way around this?

Edited by a41ramo, 30 May 2007 - 04:38 PM.


#12 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 30 May 2007 - 10:14 PM

Ok, just to be sure we are clear: you have embedded the flv into a new .fla and compiled a swf of that file. You then load that swf into your main site using the movie clip loader.

Make sure your flv is encoded as one of the following:
On2 VP6 (for Flash 8)
Sorenson Spark (for Flash 6,7,8)

There shouldn't be any reason why an flv needs AS3, unless you are trying to do something funky with it. If you've just embedded the swf on the timeline, it should be ok. Just double check your publish settings and make sure they are the same flash player version as your main site (I guess your template) is.

Flash does some strange things when you try loading different version files into one another.

Hope that helps, let me know how it goes.

#13 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 01 June 2007 - 03:00 PM

I got everything done in flash and it turned out pretty good. It isn't actually completely done but enough to upload to my site and work on the rest later. I uploaded it to my FTP through dreamweaver but it keeps saying "This page requires AC_activecontent.js". I included this in the FTP after it was published but cant seem to get rid of this error.

#14 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 01 June 2007 - 10:09 PM

Are you using CS3? If so I imagine that this script is something that was added into the Flash embed process to bypass the IE security stuff. Is it your browser giving you this error, or Dreamweaver when you upload?

You may want to try a different FTP client. Dreamweaver has given me trouble in the past. I generally use FileZilla (google it, its free). Also, you may want to try another method of embedding your swf. There is a topic in these Flash help forums about that. Check out the last post, the link is below.

http://www.pixel2lif...showtopic=20933

#15 a41ramo

a41ramo

    Young Padawan

  • Members
  • Pip
  • 8 posts

Posted 01 June 2007 - 11:10 PM

Are you using CS3? If so I imagine that this script is something that was added into the Flash embed process to bypass the IE security stuff. Is it your browser giving you this error, or Dreamweaver when you upload?

You may want to try a different FTP client. Dreamweaver has given me trouble in the past. I generally use FileZilla (google it, its free). Also, you may want to try another method of embedding your swf. There is a topic in these Flash help forums about that. Check out the last post, the link is below.

http://www.pixel2lif...showtopic=20933


It works fine when previewing in Dreamweaver CS3 but as soon as I upload to my FTP it gives that error.

#16 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 02 June 2007 - 08:11 AM

Alright, I did a bit of research, and I think this problem may be due to FF and that JS file. Go to the link I put there and use that code to embed your swf rather than AC_activecontent.js. The link has all the instructions on it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users