ActionScript 2.0 :: Loading MC From Library Into Movie
May 17, 2003
I am trying to load and duplicate a movie contained in the Library. I would like to be able to do so without dragging an instance of it into the desktop. I have gone ahead and made the linkage to javascript under the properties.
View 8 Replies
Similar Posts:
Jan 30, 2009
I'm new to AS but have some coding background (php, sql, vba) and some basic (non-AS) Flash skills.I want to create a bar chart a bit like this: http:[url].....Really would like some sample code if poss. This is my thinking:
1) Each section of the bar chart will be a movie clip, mc_2, mc_3 etc.
2) There will be an array with Qty, Type, Desc and Name of movie clip (e.g. mc_3).
3) There is a generic bar chart "block" movie clip in the library ("Block")
4) So I plan to loop through the array, attachMovie for each iteration, resize the Movie proportionate to Qty, and colour it by Type.
Problem is: (1) I don't know the right functions to use; (2) Are mc_2, mc_3 INSTANCES of my generic movieclip, "Block" ? (3) should the code sit on the timeline? (4) do i need an empty movie clip to attach the library item to?
Code:
Pseudo code:
n=length of array
for (var i:Number = 0; i < n; i++) {[code]....
The final thing would be a bit more complex with frames etc, but generating the movies would be a start.
View 2 Replies
Mar 19, 2009
(****another title for this could be "how to create a MovieClip variable")
basically, im trying to load random movie clips from the library when i run the function "TRO1".. the logic behind what im trying to do is to to first create an array containing the class names (name given in the "linkage" option) of the movie clips in the library... then randomly select an item from that array... then bring it to the stage.. Here is the code I typed:
var characterArray:Array = ["truck", "car", "boat", "train", "helicopter"]
function TRO1(event:Event):void
{
[Code].....
When i try to run the function, i get the error message "Instantiation attempted on a non-constructor..."
I think the problem is that flash doesn't understand what "randomCharacter" is in the line "var character:MovieClip = new randomCharacter();"... I assume there is a proper way of writing the "randomCharacter" variable so that i can use it in the succeeding line...
View 1 Replies
Sep 18, 2005
Basically, I have movie1, movie2, movie3, movie4 in the library, with linkages.
These are just 5 frame clips, with a single dummy_mc moving statically over the 4 frames.
I need these to be picked randomly and placed (each has its own set of co-ordinates where it should appear) on the stage at a random set interval (ie, every 2-3 seconds).
There are also 7 items (item1, item2, etc) in the library.
So once one of the 4 movies has been placed on the stage, I need one of these 7 items to randomly attach itself to the dummy_mc within that movie (and, I guess, generate instance names etc)
View 6 Replies
Sep 23, 2009
i am trying to do a survey and i have 3 buttons, each one represent an answer each button is a movie and i am wondering how to call a movie from my library to a empty movie clip called container when onRelease is used
[Code]....
View 6 Replies
Jan 20, 2004
On a few rather cliche'd flash sites, the loading process is preceded by a scrolling bar in which the percentage of loaded bytes or frames is shown. instead of making a new % scroller for every file/movie I make (and want to display separately), could I make a scroller as it's own movie and simply import it from a library? (Dumb question, I know, but I'm the kinda guy who'd prefer Perl over PHP.)
View 1 Replies
Jun 10, 2009
I've been quite frustrated over a very simple flash program I have, where I try to use code to add an item from the library to the stage. I've attached the .fla file. The errors I'm getting are: 1046: Type was not found or was not a compile-time constant: playerShip. 1180: Call to a possibly undefined method playerShip.
View 3 Replies
May 27, 2003
I want to load a mc's with a button click from the library.
View 14 Replies
Nov 9, 2009
i used this code with linkage to load a movieclip from library using flash action script 3
btn.addEventListener(MouseEvent.MOUSE_UP,goLayersS ite);
function goLayersSite(Event)
{
var myMovieClip:MovieClip = new Tree();
empty.addChild(myMovieClip);
}
i want to know how am i able to load a flash movie clip from my current library into my stage with using a button via flash action script 2.
since im using other codes in action script 2 i can not cancel them and i really need to load a movie clip in my AS2 FLA.
View 1 Replies
Feb 5, 2009
I'll do my best to keep this question as short as possible:
I've made 5 'fruit' movieclips and they're in my library.
And using so.addVariable("getNumber", "003"); in my HTML code, I'd like those particular fruit movieclips to play one after the other (and then loop).
I've had a look around for something similar, without luck, so I'm trying to make it from scratch. I got as far as getting it to load the first number and then the first type and url, but I'm stuck on getting to go onto the next type, also being able to define (with addVariable) which number's nodes gets played.
Here's an example of my XML to show the structure.
Code:
<?xml version="1.0" encoding="utf-8"?>
<list>
<number="001" >
[Code].....
View 1 Replies
Jan 17, 2011
I need to load a movie clip to the stage from the library. I also need that movie clip to load with a certain string of actionscript code in it. To load the movie clip, i checked the "export for actionscript" thing in the "linkage" section of the movie clip info, and i named the class "sol1"
I then used this code on the first (and only) frame: Code: _root.attachMovie("sol1", "NewInstanceName", {_x: 50, _y: 100}); It seems to work, but the question is, how do i load the movie clip with code in it?
View 3 Replies
Nov 29, 2009
I have built a flash animation (for a web site) that requires a number of decent quality JPG images. I don't display all of these at the start, so I don't want to wait for them all to load before starting the animation. Thus I want to be able to load these images in the background - the obvious process would involve MovieClipLoader.loadClip() method. This works fine if I am loading into an INSTANCE of a moveclip (either existing on the stage or one that I creat in actionscript) - but I really want to load into a library movieclip.
The problem is that I end up using these images in two different movies on the stage - each pulls from a movieclip in the library (that contains the image I want). So my original thought was simply to load (using loadClip()) into the library movie - which in turn would show up in the two stage movieclips that have this library clip in the timeline. However, I cannot seem to get loadClip() to work with a library object.
I tried exporting the library movieclip to actionscript (giving it a name) - but loadClip() doesn't seem to want to load into it. I can only get loadClip() to load into an instance that exists on the stage.Sorry if I am asking a stupid question - I don't do a lot of flash programming - although I have extensive programming experience in other languages.
[Code]...
View 3 Replies
Feb 8, 2010
I searched previous posts last week about this and learned that I can load a movie clip from the library in a blank mc holder similar to how I load an exernal swf. But so far that code is not working for me. I also need a way to close/make invisible the clip on user clicking an X. I have a page with about 6 key words over which I will place invisible buttons. First button instance is named compworkBtn. I have a blank mc on the stage, name of mcLoadertop. My mc I want to play is in the library and named compworkMC. I read that I need to set the properties to export and I have done this (picture attached for compworkMC).
[Code]....
Then I want the user to click on the X or close button and it goes away. I thought the easiest thing for this work be to program the Close button itself to drive the MC to a frame that had no content. It will still be there, of course, but not be visible. Then the user would click on the next key word and the next MC will load. Not sure that is a good solution though, because they will both still be there. So, I'd like a suggestion for another solution to unload the first mc and load the second one. I have done a similar thing with external swfs, but I will need a close button instance for each of the unloads, right?
View 8 Replies
Feb 25, 2010
I have several buttons that on mouse over will load a library movie clip. I want that movieclip to load on top of everything then once it's played allow me to either replay that movieclip by hovering over the button again or play a different movieclip by hovering over another button etc etc. with the ability to repeat this.
My code below currently loads my movieclip on top in hte corerct place however wont allow me to hover over another button and only plays once: var my_packages_mc:MovieClip = new packages_mc();var my_treatments_mc:MovieClip = new treatments_mc();
[Code]...
View 1 Replies
Mar 27, 2009
I'm learning AS3. There are two buttons converted to MC inthe library. Their class linkage names are: next_bt1 and back-bt1.I have a PesticideEducation.fla and PesticideEducation.as onthe same folder.Here is my code, which doesn't report any error but thebuttons don't show on stage.me find the error on myscript.
package {
import flash.display.MovieClip;
public class PesticideEducation extends MovieClip
[code].......
View 3 Replies
Feb 5, 2009
I've made 5 'fruit' movieclips and they're in my library.And using so.addVariable("getNumber", "003"); in my HTML code, I'd like those particular fruit movieclips to play one after the other (and then loop).I've had a look around for something similar, without luck, so I'm trying to make it from scratch. I got as far as getting it to load the first number and then the first type and url, but I'm stuck on getting to go onto the next type, also being able to define (with addVariable) which number's nodes gets played.[Code]....
View 4 Replies
May 11, 2010
Have buttons on the stage that when clicked, load a mc from the library into an empty mc on the stage. If another button is clicked, the loaded mc fades out, then a new mc from the library fades in. I've got it working for external .swf's loading, but I'd like to use mc's from the library.I think I need to use a attachMovie in there, but not sure how.
ActionScript Code:
var LoadMe = "";// this is just a var to store the page you want to load
// --- >> EXAMPLE FRAME CODING FOR A MC BTN
_root.homeBtn.onRelease = function() {
[code]....
View 9 Replies
Jul 13, 2010
I'm currently having trouble with the file size of my latest project. This due to the file size of certain movie clips in my library. This obviously causes a long preloading time.
To get round this I thought I could load these movie cilps when I need them so the user can proceed normally until they appear. These movie clips have a linkage with 'Export for Actionscript' selected but I haven't selected 'Export in first frame' because I want to export it later when they're needed.
how to ignore loading these movie clips until I tell Flash I want them loading. Bearing in mind these aren't external .swf's.
View 4 Replies
Dec 4, 2010
i am trying to load movieclips from the library using an array. I have manage to load a single movieclip using
var myArray:Array=[];
myArray[1]=imagex1;
var mc:MovieClip = new myArray[1];
addChild(mc);
but now I've tried using a loop by doing
var myArray:Array=[];
for(var i:uint = 0; i < 8; i++){
myArray[i]="imagex"+i;
var mc:MovieClip = new myArray[i];
addChild(mc);
}
and i get the error:
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at usethis4_fla::MainTimeline/frame1()
View 4 Replies
Feb 14, 2009
I am having a bit of a problem. I have my document class (documentClass.as) and a class for functions (functions.as).How would I go about importing functions.as so that I can use the functions in it?
View 2 Replies
Apr 2, 2003
I am pretty new to Flash and am using FlashMX. My question is 'How to you dynamically extract an image from the library onto a movie clip?
View 6 Replies
Feb 11, 2009
I've been learning AS3 for a while now, and it's my first Actionscript language, but not my first coding language. I've learned a lot so far, but I started off doing things in the not so efficient, or correct ways. I was putting all of my actionscript on frames. I'm trying to get in the habit of doing it the right way now. But I'm having a basic problem. I can't figure out how to load a bitmap from the library in AS3.
View 6 Replies
May 21, 2002
I am basing my site layout all one this one actionscript thingy...when you press a button, a window pops up. The window is from the library. It's called "ContactWindow" and its linkage is "contact".
View 14 Replies
Jul 9, 2009
getting a external class package to load and custom library item?
package {
import flash.display.MovieClip;
public class Ball extends MovieClip {
public var radius:Number;
[Code]...
View 1 Replies
Dec 4, 2010
i am trying to load movieclips from the library using an array. I have manage to load a single movieclip using [code]I new at this so i don't really understand what that means, can someone help with this?
View 4 Replies
Feb 5, 2011
I have a series of movies in my library (called page1, page2, page3... page87) and I'm looking to load the first one into a blank movie (called pageHolder).Using 'next' and 'previous' buttons, I then want to unload and load the next in the series of 'pages'. I'm trying to work out the best way to do this using addChild and removeChild, but not having much luck. I've read that the best way to do this entire sequence is to set up an array, but I have no previous experience with arrays.
View 2 Replies
Mar 16, 2011
I have 5 movies in my library, called question0, question1, question2, question3, question4. I linked them with export for actionscript. I have an Array, called questions. Then I have a button that calls the getQuestion function. But I get the following error:
[Code]....
View 2 Replies
Jun 8, 2011
I am trying to call in images dynamically from my Library in a more efficient manner.
With an bitmap image in the Library set up for actionscript with the class name of 'itemFromLib', i tried:
Code:
function placeImage():void {
var _img:itemFromLib = new itemFromLib();
var _bitName:Bitmap = new Bitmap(_img);
[Code].....
Both with the results of an error that "1067: Implicit coercion of a value of type Class to an unrelated type flash.display:BitmapData."
View 7 Replies
Apr 1, 2009
I am trying to load a movieclip from the library onto my stage. But the name of the movieclip is read in from a user-entered text field. Typically, to load a movieclip from the library named, Bee, I would do the following:
var mc:MovieClip = new Bee; // this works.
But the name of my symbol is in a TextField. The following do not work:
// Attempt #1:
var mc:MovieClip = new userfield_txt.text; // No Good
// Attempt #2:
var str:String = userfield_txt.text;
[code]....
I realize the new operator requires a Class data-type, so how do I get the value stored in a String or TextField into a Class type?
View 2 Replies
Jan 19, 2010
I used to put a load of instance names linking to library objs into an array in AS2, then use a loop to add them to the stage..I htought this would work in AS3, alas no.
Code:
var list:Array new Array("one", "two","three");
for(var i:int=0;i<list.length;i++)
[code].....
View 1 Replies