Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




How To Swap 2 Instances With Actionscript?



Like how button switches when mouse rollover and mouse rollout, except I don't want button, I need to achieve this effect with movieclip. Thx



FlashKit > Flash Help > Flash ActionScript
Posted on: 03-27-2005, 01:07 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Swap 2 Instances With Actionscript?
Like how button switches when mouse rollover and mouse rollout, except I don't want button, I need to achieve this effect with movieclip. Thx

Howto Swap Instances With Actionscript ?
Hi,
How can I swap instances using actionscript? Similar to the way you would when you use the swap symbols button on the propertys tool bar.

I want to swap the graphics of the mouse after an event occurs.

Thanks for any help!

Howto Swap Instances With Actionscript ?
Hi,
How can I swap instances using actionscript? Similar to the way you would when you use the swap symbols button on the propertys tool bar.

I want to swap the graphics of the mouse after an event occurs.

Thanks for any help!

[MX] Swap Instances...
how can you code to swap a symbol's instance? Like when you create a symbol, in the properties, it shows what it's an instance of and there is a button that allows you to swap it. Can you swap it with actionscript. Because I would like to use this feature in a game I'm working on whre you have a straight character, that on left shows charleft...ect.

Swap To Different Instances
I load, with the help of the form, the following:

_root.loader.loadMovie("Front_Page_Ad2.swf");
stop();

It loads to my instance called “contents”. I than do the following:
on (release) {
_root.contents.loadMovie("Pad_Wis.swf");
}

As you can imagine it goes over the top of “Front_Page_Ad2.swf"
How can I swap out the movies to the instance “contents”? I have several movies that swap out by different buttons.

Bob

A Code To Swap Instances?¿?
Hi,
Here's my problem:
I've got a picture in my workspace and I want to swap that image with another from the library using code. So that when a user presses a particular button the picture will change.

It's probably really simple - but I just ahven't worked out how to do it. Hopefully someone can help -
Thanks

Swap Several Instances Of Symbols
Hi there,
my project consists of several movies using a lot of the same symbols which are to be changed easily. So I decided to use a shared authoring library for the next version. As I don't want to rebuild all the movies from scratch I thaught I might just import the new symbols from the shared library and use swap symbols.
Now the question:
Is it possible to change several/all instances of one symbol within the movies (one movie at a time!) in one go?
(My movies consist of several scenes using those symbols.)


Thanks for any help inadvance
Cheers Cherry

How To Swap Instances In A Movie Clip?
Hey everyone, hopefully this should be an easy answer. I haven't had a lot of experience with actionscript other than setting up navigation for a website.

What my team is trying to do right now is build a game. It is a game where the user can build their own bike from different parts, and then test it in other challenges.

Right now I'm at the stage where they are building the bike. The first thing I'm trying to set up, is allow the user to push 3 different buttons that will change the appearance of the tires. I have the bike on a movie clip, then the tires on another movie clip within that, and then three different types of tire movie clips within that tires clip (make sense? bike>tires>3 tire clips). So I think the easiest thing would be is to somehow script each button on the root frame to just swap out the instance of the tire (the three types are: thick, aerodynamic, and trick).

I tried looking at the help and seeing if I could just have each one change visibility, but that wasn't working out well for me. Thanks for your help ahead of time!

Swap With Actionscript
hello,
i want to swap a bitmap in symbol with another bitmap in library. like editing symbol and swap bitmap button.
thanks

Swap Symbol Using Actionscript.
Is there anyway to swap symbol using actionscript? i want to create a gallery in which the previous image fades out while the next images fades in. are there other way to do this?

ActionScript Swap Symbol
Is there any way to preform a real swap symbol using ActionScript?

Thank you

Swap Symbol Via ActionScript?
Does anyone know if it is possible to swap symbols using action script and if so how do you do it? Thank-you in advance.

Swap To Actionscript 3 For Uni Work Or Not?
Hello

Im in my final year at uni and Im wondering if I should swap to actionscript 3 for my final project. Im a designer and Im led to believe as a designer if I get a job I WONT be doing any coding, that would be the coders job, at least thats apparently the setup in most businesses. So Im wondering should I learn actionscript 3 when I know how to do things in actionscript 2. I have read actionscript 3 is extremely different and more strict and code heavy. Remember that Im a designer so until I get a job I can only design things I can code and there is a time limit on my final project. I think maybe I should stick with actionscript 2 because learning a new one seems a big task with the orientation on proper coding in actionscript 3.

thanks for any input.

Image Swap Using Xml / Actionscript 2.0
I'm loading in images into my swf using a combination of actionscript & xml. Does anyone know how i'd be able to create this effect? I'd ike for if the user rolls over a bw image it swaps out to a color image. I tried using a solution some gave me a week or so ago but it doesn't seem to work with my current actionscript. Anyone able to help with this?

Here's my actionscript

Code:
#include "mc_tween2.as"
stop();
System.useCodepage = true;
Stage.scaleMode = "noScale";

var owner = this;
var selectedItem:MovieClip;
// set up initial values
var startNavY:Number = maskedView._y;
maskedView._y = contentMain._y = -maskedView._height;
arrowUp._alpha = arrowDown._alpha = 0;

//useage:
//you can modify the fellow code:
var easing = true;
//true or false mean easing or not.
var auto = false;
//true or false mean autoscroll or not
var mouseWheel = true;
//true or fale mean support mousewheel or not.
var mouseCoord = true;
//true or false mean use mouse coordinates or not.
var barVisual = true;
//when useing mouse Coordinates you can set scroll bar hid or not. false mean hid.Note:If you
//didn't use mouse coordinates and set barVisual = false.you will only use mouseWheel scroll
//content.
var space = 25;
//between list item space .
var path = "list.xml";//xml path
contentHolder_mc.contentinfo.html = true;
contentHolder_mc.contentinfo.multiline = true;
contentHolder_mc.contentinfo.wordWrap = true;
var thumbarray:Array = new Array();
//movieclip loader object
var mcl_listener = new Object();
loader = new MovieClipLoader();
loader.addListener(mcl_listener);
var myxml = new XML();
myxml.ignoreWhite = true;
myxml.onLoad = function(success) {
var item = this.firstChild.childNodes;
if (success) {
for (var i:Number = 0; i<item.length; i++) {

var temp_mc = contentMain.attachMovie("item", "item"+i, i);
temp_mc._y += i*(temp_mc._height+space);
contentMain.back_mc._height = i*(temp_mc._height+space);
temp_mc.tname = item[i].attributes.name;
temp_mc.tlink = item[i].attributes.link;
temp_mc.thumb = item[i].firstChild.firstChild.nodeValue;
temp_mc.contentinfo = item[i].childNodes[1].firstChild.nodeValue;
temp_mc.item_txt.text = temp_mc.tname;
thumbarray.push(temp_mc.thumb);

//temp_mc.item_thumb.loadMovie(temp_mc.contentinfo);
loader.loadClip((thumbarray[i]),temp_mc.item_thumb);
//contentHolder_mc.contentinfo.htmlText = item[0].childNodes[1].firstChild.nodeValue;
temp_mc.onRelease = function() {
owner.selectedItem = this;
owner.fadeOutMainImage();
};

}
//contentMain.item0.onRelease();
//startPreload(item[0].childNodes[1].firstChild.nodeValue);
// Do the transition in stuff
detailImage_mc.alphaTo(100,2);
maskedView.ySlideTo(startNavY,2,"easeOutExpo",0);
contentMain.ySlideTo(startNavY,2,"easeOutExpo",0,startScrolling);
arrowUp.alphaTo(100,1,"easeOutExpo",2);
arrowDown.alphaTo(100,1,"easeOutExpo",2);
} else {
trace("error");
}
};
function startScrolling():Void {
scrolling(easing, auto, mouseWheel, mouseCoord, barVisual);
}
myxml.load(path);
contentMain.createEmptyMovieClip("back_mc", this.getNextHighestDepth());
contentMain.setMask(maskedView);
function scrolling(easing, auto, mouse) {
//you can modify scroll speed.
var moveSpeed = 1;
//you can modify easing speed.
var easingSpeed = 20;
var scrollHeight = scrollbg._height;
//you donnot need modify the fellowing code.if you are a AS coder you can do .
var scrollable = contentMain._height-maskedView._height+2;
var top_scroll = contentMain._y;
var left = scrollbg._x-2;
var top = scrollbg._y;
var right = scrollbg._x-2;
var bottom = scrollbg._y+scrollbg._height-dragger._height;
if (scrollable<0) {
dragger._visible = false;
btnup._alpha = 0;
btndown._alpha = 0;
scrollbg._alpha = 0;
btnup.enabled = false;
btndown.enabled = false;
return;
}
//update scroll content.
function updateContentPos() {
var percent_scrolled = (dragger._y-btnup._y-btnup._height)/(scrollHeight-dragger._height);
contentMain.newY = Math.round(top_scroll-(scrollable*percent_scrolled));
//trace(contentMain.newY);
}
contentMain.onEnterFrame = function() {
if (!easing || easing == undefined) {
this._y = this.newY;
} else {
var diff:Number = this.newY-this._y;
this._y += (diff)/easingSpeed;
}
};
//dragger function
dragger.onPress = function() {
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
updateContentPos();
};
};
dragger.onRelease = dragger.onReleaseOutside=function () {
stopDrag();
delete this.onEnterFrame;
};
btnup.onPress = function() {
this.onEnterFrame = function() {
dragger._y = Math.max(top, dragger._y-moveSpeed);
updateContentPos();
};
};
btnup.onRelease = function() {
delete this.onEnterFrame;
};
btndown.onPress = function() {
this.onEnterFrame = function() {
dragger._y = Math.min(bottom, dragger._y+moveSpeed);
updateContentPos();
};
};
btndown.onRelease = function() {
delete this.onEnterFrame;
};
updateContentPos();
//++++++++++++++++++++++++++++++++++++++++++
//AutoScroll code
if (auto == true) {
onEnterFrame = function () {
if (dragger._y<bottom) {
dragger._y = dragger._y+0.3;
updateContentPos();
} else {
dragger._y = top;
}
};
}
//+++++++++++++++++++++++++++++++++++++++++++
//mouseWheel code
if (mouseWheel == true) {
var mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
if (dragger._y<bottom) {
dragger._y += delta+3;
updateContentPos();
} else {
dragger._y = bottom-3;
}
if (dragger._y>top) {
dragger._y += delta;
updateContentPos();
} else {
dragger._y = top;
}
};
Mouse.addListener(mouseListener);
}
//++++++++++++++++++++++++++++++++++++++++++++
//Mouse coordinate
if (mouseCoord == true) {
maskedView.onEnterFrame = function() {
//trace(this.hitTest(_xmouse, _ymouse, false));
if (this.hitTest(_xmouse, _ymouse, false)) {
dragger._y = _ymouse;
if (dragger._y < top + 50) {
dragger._y = top;
}
updateContentPos();
if (dragger._y>bottom) {
dragger._y = bottom;
updateContentPos();
}
}
};
}
//+++++++++++++++++++++++++++++++++++++++++++
//scroll bar hid setup
if (barVisual == false) {
dragger._visible = false;
btnup._alpha = 0;
btndown._alpha = 0;
scrollbg._alpha = 0;
btnup.enabled = false;
btndown.enabled = false;
}
//+++++++++++++++++++++++++++++++++++++++++++
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//movie clip loader preloader
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mcl_listener.onLoadInit=function(target){
//when image laoder set its width and high.
//target._width =60;
//target._height=52;


}
mcl_listener.onLoadStart=function(target) {
target._parent.attachMovie("preloader anim", "preloader_mc", 500, {_x:25, _y:25});
}
mcl_listener.onLoadProgress=function(target, bytes_loaded, bytes_total) {
target._visible = false;
target._alpha = 0;
target._parent.preloader_mc.value = bytes_loaded/bytes_total;
}
mcl_listener.onLoadComplete=function(target) {
trace("complete");
// show content
target._visible = true;
target.onEnterFrame = fadeIn;
target._parent.preloader_mc._visible = 0;
}

//+++++++++++++++++++++++++++++++++++++++++++
// PC :: 12/13/08
// Transition the scrolling nav in and out
//+++++++++++++++++++++++++++++++++++++++++++
function navTransitionOut():Void {
this.xSlideTo(-617,1,"easeOutExpo");
}

function navTransitionIn():Void {
this.xSlideTo(0,1,"easeOutExpo",delay);
}

function fadeOutMainImage():Void {
if (detailImage_mc._alpha > 0) {
detailImage_mc.alphaTo(0,1,"easeOutExpo",0, selectItem);
} else {
selectItem();
}
}

function selectItem():Void {
startPreload(selectedItem.contentinfo);
}

XML

Code:
<?xml version="1.0" encoding="utf-8"?>
<item>
<list name="Sanctuary Resort & Spa" link="Paradise Valley, AZ" >
<thumb>portfolio/p1bw.jpg</thumb>
<content>tradervics.swf</content>
</list>
<list name="Trader Vic's" link="Scottsdale, AZ" >
<thumb>portfolio/p2bw.jpg</thumb>
<content>contentpic/tradervics.swf</content>
</list>
<list name="Salobre Resort & Spa" link="Gran Canaria Island, Spain" >
<thumb>portfolio/p3bw.jpg</thumb>
<content>contentpic/salobreresort.swf</content>
</list>
<list name="Boulders" link="Carefree, AZ" >
<thumb>portfolio/p4bw.jpg</thumb>
<content>contentpic/boulders.swf</content>
</list>
<list name="Warm Springs Ranch" link="Ketchum, ID" >
<thumb>portfolio/p5bw.jpg</thumb>
<content>contentpic/warmspringsranch.swf</content>
</list>
<list name="Kimberlee" link="Scottsdale, AZ" >
<thumb>portfolio/p6bw.jpg</thumb>
<content>contentpic/kimberlee.swf</content>
</list>
<list name="Bighorn" link="Palm Desert, CA" >
<thumb>portfolio/p7bw.jpg</thumb>
<content>contentpic/bighorn.swf</content>
</list>
<list name="Southbridge Mixed-Use" link="Scottsdale, AZ" >
<thumb>portfolio/p8bw.jpg</thumb>
<content>contentpic/southbridge.swf</content>
</list>
<list name="Maravilla" link="Scottsdale, AZ" >
<thumb>portfolio/p9bw.jpg</thumb>
<content>contentpic/maravilla.swf</content>
</list>
<list name="CANAL" link="Scottsdale, AZ" >
<thumb>portfolio/p10bw.jpg</thumb>
<content>contentpic/canal.swf</content>
</list>
<list name="Pinnacle View" link="Scottsdale, AZ" >
<thumb>portfolio/p11bw.jpg</thumb>
<content>contentpic/pinnacleview.swf</content>
</list>
<list name="Mountain Vista" link="Scottsdale, AZ" >
<thumb>portfolio/p12bw.jpg</thumb>
<content>contentpic/mountainvista.swf</content>
</list>
<list name="Valley Ho" link="Scottsdale, AZ" >
<thumb>portfolio/p13bw.jpg</thumb>
<content>contentpic/valleyho.swf</content>
</list>
<list name="Montelucia" link="Paradise Valley, AZ" >
<thumb>portfolio/p14bw.jpg</thumb>
<content>contentpic/montelucia.swf</content>
</list>
<list name="Hops" link="Scottsdale, AZ" >
<thumb>portfolio/p15bw.jpg</thumb>
<content>contentpic/hops.swf</content>
</list>
<list name="Bridge House" link="Scottsdale, AZ" >
<thumb>portfolio/p16bw.jpg</thumb>
<content>contentpic/bridgehouse.swf</content>
</list>
<list name="Fairmont Scottsdale" link="Scottsdale, AZ" >
<thumb>portfolio/p17bw.jpg</thumb>
<content>contentpic/fairmont.swf</content>
</list>
<list name="Grandview at Las Vegas" link="Las Vegas, NV" >
<thumb>portfolio/p18bw.jpg</thumb>
<content>contentpic/grandview.swf</content>
</list>
<list name="Grand Central Hotel" link="Durango, Colorado" >
<thumb>portfolio/p19bw.jpg</thumb>
<content>contentpic/grandcentralhotel.swf</content>
</list>
<list name="Sanctuary Resort & Spa" link="Paradise Valley, AZ" >
<thumb>portfolio/p1bw.jpg</thumb>
<content>contentpic/sanctuary.swf</content>
</list>
<list name="Trader Vic's" link="Scottsdale, AZ" >
<thumb>portfolio/p2bw.jpg</thumb>
<content>contentpic/tradervics.swf</content>
</list>
<list name="Salobre Resort & Spa" link="Gran Canaria Island, Spain" >
<thumb>portfolio/p3bw.jpg</thumb>
<content>contentpic/salobreresort.swf</content>
</list>
</item>

Is It Possible To Swap Symbols W/ ActionScript?
hi,

can i use actionscript in a button to swap symbols in a specific frame?
if so what would the code look like?

thx,
j

Swap-symbol-command For Actionscript?
Hi.
Is there a command for the actionscript to swap a symbol? I make a little game and I want the player symbol to swap when it walks in an other direction. I use Flash MX 6.
Hope somebody can help me...

HTML Swap Image Command From Flash Actionscript
Is there a way within Flash, with actionscript, to make an image swap on an html page? Help!

Swap Graphic Symbol Bitmap Dynamically With Actionscript
I have a Graphic symbol that contains a Bitmap, and I would like to swap the Bitmap inside the Graphic symbol with an external image file at runtime using actionscript. The Graphic symbol is used in a tween, and I would like to dynamically change which image is used in the tween.

The Graphic symbol is part of a MovieClip, so I'm thinking that I need to use the loadMovie method of the MovieClip. But, how do I access the Graphic symbol, and thus the Bitmap inside the Graphic symbol.

Hope I'm making sense here. I've searched quit a bit, and no seems to have an answer for this.

Thanks!

How Do I Swap Flash Movies In Dreamweaver In Place Of Swap Image?
In Dreamweaver you can swap images on a mouseover event using behaviors.

Instead of swapping images, I want to swap flash movies.

Example:

Build a table
place and play a flash movie in a cell
on a mouseover, replace that flash movie with another flash movie.

Can it be done? It apparently can't be done directly - Dreamweaver won't see flash files as swappable. Perhaps there's a workaround.

Actionscript, Instances And PHP For Mailing
Here is my situation: Flash 2004 MX Pro

I have a movie called jsm_main1.swf, in this movie there is a preloader on the opening scene which also houses a frame that contains three text fields called name, email and comments (For a contact us Form) These are set up as instances of INP1, INP2 movies on a movie called "main". When main opens after loading is complete the contact form appears and the text fields are visable. Here is the script I am using the loadVarsNum with to send the variables from my form to php script.

++++++++++++++++++++++++++++++
<?php

$recipient = "john@jsm-inc.com";
$subject = "Web Deisgn inquiry";
$date = date( "d/m/Y - H:i:s");

$msg .= "Name: $name
";
$msg .= "Email: $email

";
$msg .= "Message: $comments

";
$msg .= "sent: $date";
mail($recipient, $subject, $date, $msg, "From: <jsm-inc.com>");
mail($email, "Thank you for your interest in jsm-inc.com. Please be patient and a representative will be back to you ASAP

************************************
It appears that you or someone you know has made an inquirey about the advertising section
on our web site. If this is in error please forgive us. Contact remove@jsm-inc.com and we will make sure to
remove you from our files.

Thank you

John Merlino
************************************

Thank you for your interest, a representative will get back to you.
", "From: JSM-Inc Web Designs <jsm-inc.com>");
?>

I am confused as to how to get the script to recognize the variables in teh form. I am loading the contact form on level two of the index page called jsm_main1.swf

When I click the contact button on the main1 page the jsm_contact.swf loads on level 2. All good so far.

When I fill in the form and submit it I get nothing.

Any help is appreciated.

JSM

P.S. Here is a link to the site so far. Much work still needed.
http://jsm-inc.com/index5.htm

thank you

Instances, Symbols & Actionscript
Ok guys, it seems I'm missing something fundamental here.

I want to create symbols (movie clips) that contain certain ActionScript for onClipEvent(load) and onClipEvent(onEnterFrame).

I have trouble understanding how script could be attached to a symbol so that all instances of that symbol contain that script.

If I create a new movie clip symbol A and write the load and onenterframe event scripts for it, the next copies of A that I drag and drop onto the scene DO NOT have the script.

The way I want it is that I have symbol A in the library and when I drop it from there to the scene, it already contains the code for the load and onenterframe clip events. How can it be done ?

Creating MC Instances With Actionscript
I need to create n diferent instances of a MC called mcPared so....there is the problem. Help is welcome.

I dont need to simulate pointers(c++) or something like that because once I created the intance I can modify it and destroy the variable(using delete) and the instance will stay there....or it wont?????!!!

Im turning crazy, help!!!!!!!!!!!!!!! please!!!!!!!!!!

Naming Instances Using Actionscript?
Hi,

Im currently in the process of creating a small game ok so game discussion should be in the games forum but my question is an actionscript question in general so here goes:

Ok so ive got 55 different instances on my stage that need naming now rather than going round naming them myself i was wondering is there anyway to name the 55 instances different name eg ins1, ins2 etc using actionscript.

Ive read through a few articles that use loops and setProperty but none of them really answer my question.

Any ideas will be appreciated.

Thanks in advance.
-*Phoenix*-

Creating Instances Through Actionscript 2.0 [help]
How do you create an instance from your library through actionscript?

Naming Instances With Actionscript
I'm trying to load random images from an xml file and then name them from the xml. I think I have everything working correctly, but when I trace it only gives me
[object Loader]
[object Loader]
[object Loader]
cherry1
[object Loader]

It's the cherry1 that is the really confusing part - it's the only one that seems to get named correctly.

Here is a sample of the xml:
<images>
<image source="flavors/creamsoda.png" name="creamSoda"></image>
<image source="flavors/rootbeer.png" name="rootBeer"></image>
<image source="flavors/strawberry.png" name="strawberry"></image>
<image source="flavors/cherry.png" name="cherry"></image>
</images>

Here is the function where I get the random image and name it:

function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();

imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList[Math.floor(Math.random() *13)].attribute("source")));
imageLoader.name = xmlList.attribute("name");
addChild(imageLoader);
trace(imageLoader);
}



Let me know if there is anymore code you would like to see and thanks very much!

Movieclip Instances With Actionscript.
This is a very general question from a newbie - how I do create movieclip instances using actionscript. Example, I would like to create a random number of instances of one movie clip already created named "movInst". I know this must be simple but I can not figure it out.

Attaching ACTIONSCRIPT To Instances Dynamically
I was wondering if it was possible to add an actionscript to a library element that is dynamically placed on the main stage when the movie is loaded.

Example:

I have a library full of symbols stored on a local drive. Can I send XML (for example)from a REMOTE server down the pipe to TELL the SWF to go to that local library, load a SPECIFIC symbol from that library, place it at SPECIFIC X,Y location on the stage AND assign a SPECIFIC action/function to it?

In a nutshell:

Can symbols be placed dynamically and can you add actionscript to an instance of a symbol dynamically?

Thanks for any help.

Actionscript Calling Funcionts On Different MC Instances
Hello,

I am trying to call a method on different MC instances where the name of the MC instance migth be different at any given time.

The instruction I'm trying to execute is:

if(isClicked==buttonId){
name = "project"+buttonId;
_level0.name.displayDesc();
}else{
name = "project"+isClicked;
level0.name.displayDesc();
}

name can be project1, project2, project3

Thanks for your help,
Fabio Cepeda

Using Actionscript To Dynamically Create Instances?
I'm a relatively new user to flash, although not completely; I've done a few sites and things in flash, but they have all been ugly and useless up until recently, so I still consider myself new to flash. But, I think this question isn't all that basic, so I don't think it's fit for the the Newbies forum.

The question is about the dynamic creation of instances from premade symbols. Let me give you some background: the content system on a site I'm currently developing has two windows, one which is a menu window and another which is the main content window. The content window's contents changes depending on which item you select from the menu window. Let's just take the News section as an example; the user clicks "News" and I want the menu section to load, from a text file, however many entries there are (the format is irrelevant right now, I'll develop a system to create and interpret the text file). Each entry has two parts: A date, and the body of the news. For each entry, I'd like to create a new button that goes on the bottom of the list in the menu window; the menu will have a simple roll-over scroll system, which I think I will be able to handle. Each of these buttons should be identical, except each bears the date which they represent. When one clicks one of the buttons, the body of the news that pairs with the date appears in the main content window.

I am planning to do this by making a template symbol for the buttons, with maybe a blank or " " text box in the middle as a place-holder, linked to a variable. My problem is, how might I create new instances of this symbol during run-time (probably using actionscript), and how might I control the individual properties of each of the separate instances (as in, date, and what content it links to), even when there could be any number of them? My thoughts are that it would be useful for there to be a way to put these instances in an indefinite array, for easy indexing, and a way for them to have object-like characteristics (as in, object-oriented programming) in that they would be common to a class but each individual instance would have their own values for each of their properties. I'm almost certain that I've heard that these are part of the main advantages of symbols and instances, but I'm not sure.

Perhaps it would be simple, perhaps it would be overly complicated, and perhaps there is a better way to do it than I am thinking of. But right now I am at a loss as for what to do; I lack even the proper syntax for this task. Any help that anyone could give me, whether to suggest an alternative method, help me understand my options, explain to me in detail how I can go about following my plan, or to tell me that this would be way over my head, would be appreciated to a nearly absurd degree.

Change Symbol Instances With ActionScript
Hello chaps,

I am a designer just picking up Flash having cut my teeth on Director and Lingo originally. Funny way of doing things I know?

I have a little slide show thing running that fades between different images via a TWEEN that I have repeated over 10 different SCENES for each different image.

This is rather clumsy and I would like actually to use one scene but to have a BUTTON click change the graphic SYMBOL used for a given INSTANCE.

This was easy enough to do in Director with a Sprite CastMember change if memory serves me. I wonder if there is an equivalent in Actionscript in Flash MX. I have scoured the Actions menus and cannot seem to find anything that suits??? But there has to be surely!!!

Thanks in advance for your help...

Create Instances Of A Symbol Using ActionScript?
Can i create instances of a Symbol using ActionScript?

Grouping Similar Instances In Actionscript
I'm pretty sure you can do this, but for some reason, I can't find it for the life of me. I'm trying to find a way to group similar instances together in actionscript. For example, let's say that I have a bunch of similar buttons that execute a function when pressed, is the there a better way to code this?

myButton1.onRelease = function(){
myButtonAction();
}

myButton2.onRelease = function(){
myButtonAction();
}

myButton3.onRelease = function(){
myButtonAction();
}

myButton4.onRelease = function(){
myButtonAction();
}

myButton5.onRelease = function(){
myButtonAction();
}

I just used buttons as an example, but this also goes for dynamic text boxes and movie clips. Can anyone point in the right direction for this? Thanks!

How To Create Different Instances Of A Symbol With Actionscript ?
I have a symbol in the library and I want to create different instances of this symbol dynamically.

These instances have to have different text content, so actually each instance has to be different from the others.

Which is the simplest way to do this using actionscript ?

thanks

Refer To Mutiple Instances In Actionscript
hi, i'm making a game where you shoot enemy ships from your ship. i've made it so that i can shoot one ship but i want to be able to have many instances of the same symbol on the stage and them to all work with this bit of actionscript. how can i make it do this? please help

ps. i want the enemies coming in in a structured way rather than a random one

Adding Different Actionscript To Multiple Instances From The Same Symbol
well thats it, kind of. i have a movie, inside that movie is a button, and a layer with animation that is activated with script when the button is moused over, with the use of the call action. i have about 10 instances of the movie on my scene, however i dont know how to add different actions to one instance without it affecting them all. i'm a bit of a beginner to actionscript, so i dont know what to do. i could upload the file if it might help. well, if anyone understands what i am trying to do, and knows how to do it...let me know, i could really use the help.
thanks, Ben

[F5] ActionScript Problem On Movie Clip Instances
I am using Flash 5 and am new to Flash in general. I have been reading a book called "SAMS Teach Yourself Macromedia Flash 5 in 24 Hours" by Phillip Kerman, for the past few days now. I am a little more than half way through the book and I have reached a road block! The exercises in the book dealing with setting Actions for Movie Clip Instances are NOT working as described in the book.. I have been able to reproduce everything in the book on my computer, until this

The two .fla files are attached to this post (hopefully I attached them correctly, as I have not done it before on this forum)

One is simply a circle movie clip instance that has a STOP action applied to it that is suppose to STOP the clip from animated upon loading. Stop it IMMEDIATELY. This action is not stopping anything at all when I test the movie. No error messages are produced.

The second, is a car, with two rotating instance movie clip wheels, all combined together as one instance. I could successfully stop the car from moving with a STOP Action. The release of the red button in the lower right hand corner is suppose to trigger the Stopping of the car and front wheel upon the button's release. When I try to stop the nested movie clip wheels from rotating as well, the Action as described in the book, doesn't work (nothing stops at all, not even the car body) and I get the following error messages in a Generator log:

Error messages resulting from testing movie, "Failed action on nested instance.fla"
----------------------------------------------------------------------------------------------------------------------------


Scene=Scene 1, Layer=button, Frame=1: Line 3: ')' expected
with (the_car.front wheel) {

Scene=Scene 1, Layer=button, Frame=1: Line 4: Statement must appear within on handler
stop ();

Scene=Scene 1, Layer=button, Frame=1: Line 5: Unexpected '}' encountered
}

Generator is not enabled for this movie. D:Flash testsFailed action on nested instance.swf

The wheels are suppose to be stopped by a WITH statement following the STOP statement. In the .fla file I am just trying to stop the front wheel along with the whole car, as I could not even get that to work let alone stopping both front and rear wheels together..

After being frustrated by this for hours I decided to try and post a message on this forum. Any help with this would be most appreciated.

Steve

Several Button Instances, Same Url, Need Global Piece Of Actionscript
I have a button that appears in several places within my flash file. They all link to the same URL. I'd like to put just one piece of action script for "get URL" that will apply to all instances of the button. Can this be done? Thanks

UsingFlash 8

Creating Multiple Movieclip Instances Using ActionScript?
Hi, this is my first time using these forums. Any help will be greatly appreciated.

Right now I have a movieclip made in the library. I need to:

1) Create multiple instances of that button and dump them on the stage using actionscript.

2) Name those instances with an array of names I have already made: e.g. "Jack", "Sam", "Joe", "Eddy"

3) Create a single array to point myself to all those instances.

How do I accomplish this? Thanks!

WARNING: Actions On Button Or MovieClip Instances Are Not Supported In ActionScript 3
What does this mean?


Quote:




WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0. All scripts on object instances will be ignored.
TypeError: Error #1006: value is not a function.
at video_fla::MainTimeline/video_fla::frame1()
TypeError: Error #2007: Parameter type must be non-null.
at flash.events::EventDispatcher/addEventListener()
at video_fla::volume_3/video_fla::frame1()
TypeError: Error #2007: Parameter type must be non-null.
at flash.events::EventDispatcher/addEventListener()
at video_fla::timeLine_7/video_fla::frame1()

Swap Images Or Swap Symbols?
I want to load a bunch of images dynamically -- into different movie clips. And then simply have a master clip which lets me swap out these dynamically loaded clips. Is that possible?

Can I do a swap or replace symbol on the Master to have it be replaced by each loaded clip one after the other?

Can Instances Be Attached To Instances ?
can instances be attached to instances using attach movie??

what i am doing is creating an instance of a movie by dragging and dropping and attaching a movie to a symbol and then i want to attach my new movie instance that i just created to another instance... can i do that...??

thanks

Swap MC's
Hello,

i have a MC1 and during the running of my flash movie i want to remove MC1 and place MC2 in its position. Just like the swap command in the properties window...is this possible with actionscript?

Thanks,
Miguel

Swap Mc
hi, idiot user here.
basically i'd like to drag a symbol over a specific area and for it to swap with another symbol while held over that area.
i figured out the dragging ok.....
my_mc.onPress=function(){
my_mc.startDrag();
}
my_mc.onRelease=function(){
my_mc.stopDrag();
if(my_mc.hitTest(area_mc)==true){


now how dod i swap it??

thanks

Swap ?
Hi,

is it possible to write a bit of code which when called upon, swaps one movie clip with another?? without jumping to another frame?

cheers,
g

Swap MCs'
How do you change an MC into a different one in the middle of a movie?

Swap X/Y
Hi,

So far, my code:


PHP Code:



fscommand("allowscale", "false");
bar.useHandCursor = dragger.useHandCursor=false;
space = 20;
friction = .9;
speed = 4;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._height-space;
dragger.onPress = function() {
    drag = true;
    this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
    dragger.scrollEase();
};
dragger.onMouseUp = function() {
    this.stopDrag();
    drag = false;
};
bar.onPress = function() {
    drag = true;
    if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
        this._parent.dragger._y = this._parent._ymouse;
        this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
    } else {
        this._parent.dragger._y = this._parent._ymouse;
    }
    dragger.scrollEase();
};
bar.onMouseUp = function() {
    drag = false;
};
moveDragger = function (d) {
    if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
        clearInterval(myInterval);
    } else {
        dragger._y += d;
        dragger.scrollEase();
        updateAfterEvent();
    }
};
up_btn.onPress = function() {
    myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
    myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
    clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
    this.onEnterFrame = function() {
        if (Math.abs(dy) == 0 && drag == false) {
            delete this.onEnterFrame;
        }
        r = (this._y-y)/(bar._height-this._height);
        dy = Math.round((((top-(top-bottom)*r)-main._y)/speed)*friction);
        main._y += dy;
    };
};




is used to control a horizontal scroll bar. How would I go about making it horizontal? Where would I change the Y values to X?

Thanks

--iMat

Swap
hi, so i use loadMovie to load some.swf to loaderMC (the target),which can be a movie clip in an swf on level90. then i use this.swapdepths(50); to tell loaderMC to swap to level50 and it will take some.swf with it?

do you think you could rewrite- this.swapdepths(50);
so that it is correct, i guess this becomes loaderMC?

thanks very much
mark

Swap 2 Swf's
I have created 2 swf files and I would like to attach to a button the action script to switch from one to the other. Please can anyone help. my two files are hamopen.swf and hampanto.swf

i have tried

on (release) {
loadMovie("Hampanto.swf");
}

but it doesn't work


thanks

Swap To Top
currently using:

on (press) {
this._parent.BUT1.swapDepths(this._parent.BUT2);
this._parent.BUT1.swapDepths(this._parent.BUT3);
}

can i simple call the pressed button to the top layer with code?

cheers rat

Copyright © 2005-08 www.BigResource.com, All rights reserved