ActionScript 3.0 :: Creating A Function That Loads MCs Onto The Stage?

May 10, 2011

I would like to make a function that lets me load a movie clip onto the stage like this:

ActionScript Code:
function callImage(i:Class):void {
var img_loader:i = new i();
stage.addChild(img_loader);
}
callImage(b0_base);

b0_base is the class name for my MC. Is this possible? or do I have to write a different function for each Movie clip?

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Creating Menu That Loads SWF Onto Stage

Sep 21, 2008

I am real new to action script 3 and I am looking for a way to create a menu that loads my swfs onto the stage, I want the swfs to replace each other when a new button is selected but dont know what function to use.

View 8 Replies

ActionScript 2.0 :: Creating A UI That Loads An Xml File

Apr 5, 2011

I will be creating a UI that loads an xml file. The UI will allow the user to edit some questions and categories that are found in the xml. (UI pulls data from xml). Will this require use of php and mysql? Is there a way to do it without using a server side language-say I want this to run standalone..not online....

View 3 Replies

ActionScript 3.0 :: Creating A Site That Loads External .swfs As Pages?

Jan 28, 2009

I'm creating a site that loads external .swfs as pages. I have little understanding of how Loaders and instance names work with AS3 (even after reading the documentation), so I'm having some difficulties.

I'm loading the .swfs in a movie clip named "container." I want to replace the contents of "container" with the web page .swf that the user chooses, but I don't know how to write the condition to:
a) check to see if something is already inside "container"b) remove the contents by instance name or method of MovieClip. I'd prefer to remove whatever is inside of "container" rather than switching cases for different instances.

[Code]...

View 3 Replies

ActionScript 3.0 :: Creating A File That Loads Images Dynamically And Scrolls Through Them?

Mar 23, 2009

i am creating a file that loads images dynamically and scrolls through them. this is all being read from an xml file. i am able to do everything but get the buttons to work.whenever i click on a button, it gives me the value of the last button, not the current button. for example, if four buttons load, if i click on any button, it always traces the value of 4.

here is the code:

Code:
//load xml file
var xmlLdr:URLLoader = new URLLoader();
var xmlD:XML = new XML();

[code]....

View 7 Replies

ActionScript 2.0 :: Call A Function That Loads An Image?

Aug 22, 2005

I've got a dynamic text field [var = NameLast] that is given a value when I an ASP page to call the database. When NameLast is equal to a certain value, I would like it to call a function that loads an image.I'm sure this is simple, but I can't seem to get it to work. Here's my code:

if (NameLast="Smith") {
_root.createEmptyMovieClip("container",2);
loadMovie("mag1.jpg","container");[code]....

View 2 Replies

ActionScript 2.0 :: When Click A Subject On The Menu; A Corresponding Movie Loads On The Stage

Sep 4, 2004

On a menu I have various school subjects. I have a separate movie for each subject. When you click a subject on the menu; a coresponding movie loads on the stage.

The actionscripting is quite simple:

on (release) {
loadMovie("Art.swf", "_root.Facilities");
}

Yet however I try I can't get the swf to load .

I realise I need to configure the target so the swf loads in the right place but I'm unsure if this is the problem.

View 3 Replies

ActionScript 2.0 :: XML Loads Other XML Files, Onload Function In Onload Function?

Nov 20, 2006

I am writting an image gallery that loads one intial xml file named galleries.xml.From this point each xml node loads a XMl file for that gallery that holds all the images.The problem arises in the fact that to do this I need a onload function within an onload function.Onload functions dont accept parameters so I can pass down the variable that shows what loop the gallery loop is on as I need that in the function that holds the images.

View 4 Replies

ActionScript 3.0 :: Call An Eventlistener Function That Loads Xml Files

May 11, 2010

in a for loop I call an eventlistener function that loads xml files. But the for loop keeeps running without waiting for xml to load.What should I do to prevent that? I need for i=0 {load xml}and after xml is loaded go to next step, which is i=1.

View 8 Replies

ActionScript 2.0 :: Loads In An XML File, Then Attempts To Call Another Function?

Mar 9, 2005

have this method within a class. It loads in an XML file, then attempts to call another function. For some reason however, the loadXML() does not execute. If I put a trace right before it, the trace executes. If I take that function out of the onload, it executes.

private function openXML (URL:String) {
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;

[code].....

View 1 Replies

ActionScript 2.0 :: Fullscreen The Video Object Loads In The Top-left Corner Of The Stage?

May 8, 2008

I'm working in a xml videogallery and I'm using a video component... The problem is that when I go fullscreen the video object loads in the top-left corner of the stage (is a 800x600 movie) tough I publish my movie with 100% x 100% dimensions.

[Code]...

As you can see after the first fullscreen the stage remains in the Top Left corner. Is there any way to make the stage return to the center? I need to do it when I return from fullscreen to normal mode... or.. what can I do? I tried to put the gallery inside a MC and center it but still fails cos the video object loads in the registration point of the MC (like in the first example I've provided)...

View 4 Replies

ActionScript 2.0 :: SendAndLoad Fails To Load First Time And It Loads When I Call The Reload Function?

Aug 2, 2010

It doesn't load during the first load.

myVars= new LoadVars();
myVars.onLoad = function(works)
{
if(works){

[code].....

I am tryin to hit a servlet to get the data.

View 1 Replies

ActionScript 2.0 :: HTML Loads A Preloader That Then Loads The Actual Flash Movie?

Mar 28, 2009

Everything is embedded in an HTML site. The HTML loads a preloader that then loads the actual flash movie. Inside this movie I created a few buttons, inside a scroll bar movie clip. I want the buttons to load a whole new movie inside the same html. The code I'm using in the button is simply:

on(release) {
loadMovie("new_movie.swf", 0);
}

The problem is that it works beautifully in the Flash movie tester but doesn't do anything when tested inside the browser, embedded in the HTML. I think the problem is that the HTML embeds as an object the first movie, the preloader for the menu movie, not the menu movie itself.

View 3 Replies

ActionScript 2.0 :: When The Xml Menu Loads Swf File Its Structure Loads But Not Its Data?

Feb 23, 2010

have this flash xml menu that loads external swf files like this:

Code:
<item title="ABOUT"content_path="http://mysite.com/folder1/folder2/folder3/about.swf"target=""mouse_rollover_color="0xFFFFFF" mouse_rollout_color="0xDDDDDD" />

and I have this swf file with cms that I'd like for this menu to load. Currently the swf file load external text using this code:

Code:
if (contenturl1 ne "") {
loadVariablesNum(contenturl1 + "/" + userid + "/content.txt", 0);[code].....

but when the xml menu loads this swf file its structure loads but not its data.I tried using :

Code:
this._lockroot = true;

in the loading swf main time line but it did not work.I should also mention that the dynamic data that loads onto the swf that is to be loaded by the menu, resides not in it main time line but 4 movie clips deep .I don't know if that makes a difference or not.

View 1 Replies

ActionScript 3.0 :: Creating Links Between Pages On Stage

Sep 16, 2009

I was wondering how do I make a link to a new page from a page that has already been played onto the stage. The pages are made from movie clips, and the buttons are also movieclips. So for example, I click on about us from the menu bar, and the page animates on, and within that page is another link to go to another page. I just cannot get it to work. All the pages that I have are made from movie clips.

View 9 Replies

ActionScript 3.0 :: Creating Bitmap Representation Of Stage?

Nov 21, 2009

So, I want to create an effect such that each frame I :
1 ) create a bitmap representation of the stage.
2 ) reduce the bitmap's alpha to .75
3 ) remove any currently existing bitmap from stage
3 ) add new bitmap to stage.

If I'm correct in my thinking, this should effectively create the illusion that the stage is fading over time, as every time you call bitmapData.draw() the bitmap will be set at .75 alpha. This *should* mean that when I apply .75 alpha to the new bitmap that it should effectively result in a new image that is .75 * .75 alpha (.56), then on the next frame again it should be lower still (.42), and on... .31, .23, .17, and so on... But it seems that what's *actually* happening is that the new bitmap always *looks* like it's .75 alpha every frame.

ActionScript Code:
import flash.events.*;
import flash.display.*;
// draw a black box...
this.graphics.beginFill(0x000000);
this.graphics.drawRect(0,0,100,100);
this.graphics.endFill();
[Code] .....

Additionally, I've tried using stage.invalidate and doing parts of this in an Event.RENDER handler, but it didn't work either...

View 7 Replies

ActionScript 3.0 :: Creating Instance Of TextField On Stage

Oct 5, 2010

I wanted to create an instance of a textField on the stage with simple text. I thought the following piece of code would work:

var textfield1:TextField = new TextField();
textfield1.text = "testing text";
textfield1.x = 300;
textfield1.y = 300;
textfield1.height = 150;
textfield1.width = 150;
textfield1.autoSize = TextFieldAutoSize.LEFT;

As far as I can tell the object is created and IS there but I have to call it somehow I guess.

View 2 Replies

ActionScript 3.0 :: Creating Instances Of One Button Onto Stage

Jan 16, 2011

I am working on a project in which I need to create a bunch of buttons.. all need to look the same with different text on the button.. rather then making each button separate in my library I would like to make one and create instances of the one button. I have created a button with a text field on top named txtLabel with a default text of "Label Here". I have dragged an instance of the button onto the stage and named it btnHome
btnHome.txtLabel.text = "Home"; d
Does not work..

I get the following error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MyProject_fla::MainTimeline/frame1()

View 9 Replies

ActionScript 3.0 :: Creating Objects From Arrays On Stage

May 7, 2011

I've got four arrays which I want to use to create objects on the stage.
The first one is what the Object Class is called.
The second one is what I want the instance name to be.
The third and fourth relate to the x and y co-ordinates respectively.

ActionScript Code:
var objectName:Array = [Background, Frame, Up, Down, SideBar, Yellow, Green, Pink, Blue, Titles,
TimeBar, TimeBarSlider, Stop, Play, Pause, ThumbnailOutline, Thumbnail];
var instanceName:Array = [bg, frame, up, down, sideBar, yellow, green, pink, blue, titles,
TimeBar, timeBarSlider, stopBtn, playBtn, PauseBtn, thumbnailOutline, thumbnail];
[Code] .....

The "i" would relate to the parameters for the same object. So, if i = 0, then the Object Class Name would be: 'Background', the instance name would be 'bg', the x position would be '0', and the y position would '0'. What code would I need in the for loop to create this?

View 7 Replies

ActionScript 3.0 :: Creating A New Movie Clip On The Stage?

Jul 25, 2011

I've got the actual calculator part working fine, but depending on the number I want to display product recommendations. I thought the best way to do this would be to create movie clips with the products and use the addChild function to create new one.

Code:
stop();
equal_btn.addEventListener(MouseEvent.CLICK, equClick);

[code].....

View 1 Replies

ActionScript 2.0 :: Creating Multiple Movieclip In Stage

Mar 8, 2006

It is posible to create multiple movieclip in stage by clicking one button with different instance name.

View 1 Replies

ActionScript 2.0 :: Creating Empty MC And Fill Stage With Box

Mar 2, 2007

I'm writing a very simple AS2 class, that only should create an empty movieClip and fill the stage with a box drawn with the lineTo property. But for some reason, Stage.height always returns a number that is exactly 100px less than the actual stage height.

Code:
class centre {
public function centre() {
createBg();
trace("width: " + Stage.width);
trace("height: " + Stage.height);
[Code] .....

View 2 Replies

IDE :: Creating A Sprite, And Adding 100 Instances To The Stage

Jul 16, 2009

I thought would be coded like this:

var sp:Sprite = new Sprite();
sp.graphics.beginFill(0xFF88CC);
sp.graphics.drawCircle(0, 0, 50);

[Code].....

however, I realize even tho im looping that addChild method, its still adding sp, so do I add a new naming convention in the loop, or should I be adding these instances to another display object.... this seems like such a simple thing to do yet I cant figure it out, I also want to randomize the x and y, but this first seems to be the issue I need to address.

View 1 Replies

IDE :: Reposition Symbols On The Stage W/out Creating Motion?

Feb 9, 2010

I am using CS4. I have my Flash all setup and running perfect now w/ motion tweens etc.But I am trying to reposition some of my symbols on the stage (to get them into better alignment with other symbols), and every time I do this the move is recorded, and when I play back it shows the motion of my position change on my tween.Is there a way to simply move my symbols w/out losing their current tween, but not creating a new motion effect?

View 1 Replies

ActionScript 3.0 :: Creating The Right Vars To Move The Movieclip Off The Stage?

Jun 1, 2009

I'm trying to change some great code cbeech authored for me a while ago. I'm just trying to change the code to use Tweenlite and to make it that so I fully know how to edit the code, thus make it modular for me. Right now the code uses the flash tween classes. I rather use Tweenlite.So, basically what the code does is tween a movieclip on its X axis. Thus, when a button is pressed, the corresponding movieclip tweens out to the right and the other one tweens in from the left simulataneously. But I need to code to be completely modular, in case i want to do the same thing o n the Y axis, or if I need to add some more properties to the tween.

Here's the code cbeech crafted, which is great but I'm not skilled enough, yet, to edit to fit all of my circumstances:

[Code]...

I need help creating the right vars to move the Movieclip off the stage when I clicked a button to tween a new movieclip onto the stage...my main plan is to make this code modular and simple enough for me to edit the x y or z, or even the scale properties...cbeech code is awesome, but I'm not skilled to edit it to fit all of my needs.

View 6 Replies

ActionScript 3.0 :: Creating MovieClip From TextField Object On Stage?

Aug 16, 2010

I'm just creating a movieclip from a text field object on the stage, giving it an instance name and setting some timeline animated over and out states for it. I'm then setting it up in AS3 to work like a button, so nothing complicated at all. But I am getting errors I have never seen before. Code is very simple basically I have a button called 'hair' contained within the mc 'menu', here it is:

Code:
menu.hair.addEventListener(MouseEvent.MOUSE_OVER , itemOver);
function itemOver(e:Event):void {
trace(e.target);
e.target.gotoAndPlay('over');
}

So I noticed there are some new text options in CS5, but none of them give the result I want. If I leave this as the (now default) TLF text, it gives a couple of errors related to this no longer being a movieclip;

Code:
ReferenceError: Error #1069: Property gotoAndPlay not found on flash.text.engine.TextLine and there is no default value.
at CL022_fla::MainTimeline/itemOver()
[object SimpleButton]
ReferenceError: Error #1069: Property gotoAndPlay not found on flash.display.SimpleButton and there is no default value.
at CL022_fla::MainTimeline/itemOver()
[object TextLine]

If I change it to classic, there are no errors, but the gotoAndPlay does not work. If I change the text to outlines, it works as per normal.

View 2 Replies

Professional :: Creating A Link And/or A Function?

Apr 29, 2011

So I've gone through a few different websites looking for a way to make a symbol a link, and I keep running into the same problem. I am using action script 3.For example, I got this code from this page:[url]....[code]......

It makes the symbol (logolink) a link (changed the mouse cursor to a pointer), but it kills my animations and errors out saying (all on line 4...the function callLink line): "expecting leftparen before colon", "expecting identifier before leftbrace", and "expecting rightparen before leftbrace".I tried a few things like adding an unused parameter, and a couple other things (trying to satisfy the above errors), but then I get "call to possibly undefined method addEventListener through a reference with static type Class"

View 6 Replies

Flex :: Creating One File Per Function With Same Name?

Apr 21, 2009

I am relatively new to Flex/ActionScript, but I have been using a pattern of creating one file per function in my util package - with the name of the file being the same as the name of the function.

Like if the file was convertTime.as:
package util{
public function convertTime(s:String):Date{
...
}}

This way I can import the function readily by doing:
import util.convertTime;
...
convertTime(...);

I like this way better than importing a class object and then calling the static methods hanging off of it, like this:
import util.Util;
...
Util.convertTime(...);

But, the more I do this, the more files I'll end up with, and it also seems a bit wasteful/silly to put only one function into a file, especially when the function is small. Is there another alternative to this? Or are these two options the only ones I have?

View 4 Replies

ActionScript 3.0 :: Creating A Custom Function?

Sep 2, 2009

i have a set of "if conditionals" that should always be together,what i want to do is to put these conditionals in a function... then call the function once needed. i want to call this function once the flash starts playing + when i click on any of the 3 buttons.

here is the code so far:

ActionScript Code:
var btn1:Boolean=true;
var btn2:Boolean;
var btn3:Boolean;

[code]....

the problem is button1 should have no eventlistener once the movie starts playing, but it has all listeners... so how can i make AS reads BtnStatus function once it starts loading

View 2 Replies

Have An Animated Logo Swf File That Loads And Runs Once On The Home Page Every Time The Page Loads?

Jun 25, 2009

I have an animated logo swf file that loads and runs once on the home page every time the page loads. The logo has been updated to appear in three different colour schemes. I want one scheme to load and when the page is refreshed or revisited, one of the other colour schemes to load in its place. They can appear in any random order, just a different one to the one that played before reloading.Can someone point me to an answer or tell me how to do it? I have found a way in JavaScript but this only works on plain images, not swf files.

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved