Adding Action Script To Instances...
I'm pretty frustrated and am done searching the site. Awful...just awful. Anyway...
Using Flash CS3 for the first time since upgrading. I'm not able to add action script to instances. Certainly this isn't a change. I've created a button symbol. I've named the instance upon dragging it on the stage. Now it tells me I can't apply actions to it.
I hope I'm just missing a step.
Adobe > ActionScript 3
Posted on: 12/25/2008 03:31:59 PM
View Complete Forum Thread with Replies
Sponsored Links:
Help With Adding Variables/instances
Alright, on my website www.fatbug.com I have an order form, the user can pick between how many labels they want, and what type of shipping using a combo box. What im trying to do is have a dynamic text box display the total purchase i.e. $575 for 5000 labels and 25 for priority shipping.
Here is the .fla and i hope to hear back!
http://www.yousendit.com/transfer.ph...774319571CB7C7
View Replies !
View Related
Help With Adding Variables/instances
Alright, on my website http://www.fatbug.com I have an order form, the user can pick between how many labels they want, and what type of shipping using a combo box. What im trying to do is have a dynamic text box display the total purchase i.e. $575 for 5000 labels and 25 for priority shipping.
Here is the .fla and i hope to hear back!
http://www.yousendit.com/transfer.php?action=download&ufid=93774319571CB7C7
View Replies !
View Related
Adding Multiple Instances Of The Same Movieclip
Hi! I have a bunch of buttons that are in an array, and when you click on a button, a specific movieclip is placed on the stage. I just realized that I can only add one instance of a movieclip. For example, if I click on the crayon button, an image of a crayon appears, but nothing happens if I click the button again. How do I allow for multiple instances of the same movieclip to be placed on the stage?
Here is the code I'm working with:
PHP Code:
var itemsByButtonCog:Dictionary = new Dictionary();
var itemArrayCog:Array = [//Cognitive
new mcMirror(), new mcBrain(),
new mcCalendar(), new mcClock(),
new mcBook(), new mcCalculator()];
var buttonsCog:Array = [//Cognitive
cogChar_mc.cogCharContent_mc.mirror_btn,
cogChar_mc.cogCharContent_mc.brain_btn,
cogChar_mc.cogCharContent_mc.calendar_btn,
cogChar_mc.cogCharContent_mc.clock_btn,
cogChar_mc.cogCharContent_mc.book_btn,
cogChar_mc.cogCharContent_mc.calculator_btn];
for(var j:int = 0; j < buttonsCog.length; j++){
buttonsCog[j].index = j;
buttonsCog[j].buttonMode = true;
itemsByButtonCog[buttonsCog[j]] = itemArrayCog[j];
buttonsCog[j].addEventListener(MouseEvent.CLICK, itemMoveCog);
}
function itemMoveCog (event:MouseEvent):void {
var itemCog:Sprite = itemsByButtonCog[event.currentTarget];
itemCog.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
itemCog.addEventListener(MouseEvent.MOUSE_UP, dropIt);
MovieClip(root).mainStage_mc.addChild(itemCog);
}
Thanks in advance for any help!
View Replies !
View Related
Adding Multiple Instances To One Function
Hey there,
I'm having trouble adding multiple instances to one function, however theres one small difference in each function, is there a way around having to repeat the setInterval function button everytime?
Thank you in advance
below is the code i'm working with and there ten buttons;
Code:
answerOne.onRelease = function(){
var P = _root.Patents_1;
_root.infoPanel.T.embedFonts = true;
_root.infoPanel.T.text = nn;
_root.infoPanel._visible = true;
var x:Number;
obj = new Object();
obj.interval = function() {
_root.infoPanel._visible = false;
clearInterval(x);
}
x = setInterval( obj, "interval", 4000 );
};
answerTwo.onRelease = function(){
var P = _root.Patents_2;
_root.infoPanel.T.embedFonts = true;
_root.infoPanel.T.text = nn;
_root.infoPanel._visible = true;
var x:Number;
obj = new Object();
obj.interval = function() {
_root.infoPanel._visible = false;
clearInterval(x);
}
x = setInterval( obj, "interval", 4000 );
};
and so on.........................
View Replies !
View Related
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
View Replies !
View Related
Adding Many Flash Instances. Performance Issues?
I had a general question about adding many flash embeds on a page. I have a page with 12 transparent, non-animating swf files, ech showing a single static images and each roughly 20k in size. But my concern is that on slower machines this might be taxing on the CPU, cause memory issues, maybe page loading issues...?
Any thoughts on this or other concerns?
View Replies !
View Related
Adding Thousands Of Instances Of A Movie Clip
I am trying to add around 20,000 instances of a single small movie clip (HexTile) from the library into a container Sprite using actionscript. The problem is it loads immediately and it loads very slowly, so I would like to know if there is a way to preload it? The class that adds the movie clip library symbol (World) is not the document class, nor is it referenced from the document class. I have tried dragging an empty sprite linked to World, and I have tried exporting it to other frames as well is preloading it as it's own .swf...any suggestions would greatly appreciated! The code looks like:
Attach Code
public class World extends Sprite
{
private var map:Sprite;
function World()
{
map=new Sprite();
addChild(map);
placeTiles();
}
//Place hexagon tiles onto the map
private function placeTiles(map_width:uint=75,map_height:uint=75):void
{
var tempTile:HexTile;
for (var i:uint=0;i<map_height;i++)
{
for (var j:uint=0;j<map_width;j++)
{
tempTile=new HexTile();
map.addChild(tempTile);
}
}
}
}
View Replies !
View Related
Looping (or Adding Multiple Instances) Of MoveClips
Hey guys,
Im making a navigation and ive ran into a hang up, i want the content to repeat over and over when i scroll, but am not sure how to do it.
this is my setup:
I have a Swf that holds my controls (up/down). This swf loads another swf into a "holder" MC that acts as the content for the display.
The problem I am having is that i want for the content to loop over and over, so its seemless when you scroll. However, using the seup ih ave now, Im not sure how to acheive this. Any ideas or pointers guys?
Heres my code for the parent SWF
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
uparrow.onRelease = up
downarrow.onRelease = down
onEnterFrame(loadMovie("newprojectsSLIDER.swf",holder));
var ypos:Number = holder._y;
function up (){
var ytween:Tween = new Tween(holder, "_y", Strong.easeOut, ypos, ypos+105, .8, true);
ypos+=105;
}
function down (){
var ytween:Tween = new Tween(holder, "_y", Strong.easeOut, ypos, ypos-105, .8, true);
ypos-=105;
}
newprojectsSlider.swf is the "content" then the buttons move the MC holding it up or down.
You can find the sample Here
Thanks a Million
View Replies !
View Related
Adding Multiple Instances Of A Movieclip To Stage
Hi there,
Still in the process of learning AS3 and was wondering how to attach multiple instances of a movieclip to the stage. In AS2 I would do the following:
Code:
for(var i = 1; i <= 10; i++){
attachMovie("myMovie", "myMovie" + i, i);
}
but I can't figure out how to do this with AS3.
Any ideas?
Bob
View Replies !
View Related
Adding Action To Button Stops Other Action.
Flash MX.....
I have two frames, there resides on the stage a button with the instance name "blabla".
First frame actionscript is.....
blabla._y = blabla._y + 1;
Second frame actionscript is........
gotoAndPlay(1);
The button slides down the screen when published, that is the desired effect.
Problem..... as soon as I add any actionscript to the button, even just two comment slashes "//", the movement stops.
I have a feeling that there is some really basic concept that is flying over my head at the moment.
View Replies !
View Related
How Do I Put Multiple Instances In One Action?
So here is what I've got:
//
on (releaseOutside, rollOver) {
gotoAndPlay("go");
}
on (rollOut) {
gotoAndPlay("out");
}
on (release) {
this.gotoAndStop(25);
if (_parent.mc1._currentframe>1) {
_parent.mc1.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc2._currentframe>1) {
_parent.mc2.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc3._currentframe>1) {
_parent.mc3.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc4._currentframe>1) {
_parent.mc4.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc5._currentframe>1) {
_parent.mc5.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc6._currentframe>1) {
_parent.mc6.gotoAndPlay("out");
}
}
//
So How do I put all of thes into one
on (release) { action?
Your help is very much appreciated. THANKS!!!
View Replies !
View Related
Assigning Same Action To All Instances Of A Button?
Hi.
I have two buttons used extensively throughout my project. The actions for the buttons always stay the same.
Button 'a' will always be:
Code:
on(release)
{
prevFrame();
}
Button 'b' will always be:
Code:
on(release)
{
nextFrame();
}
Without assigning these same actions to every single instance of the button, is there any way to assign an 'on release' action for every instance of a button to do the same throughout the movie? Just saves me repetition of code.....and time....
Thanks.
View Replies !
View Related
Press Action In Graphic Instances
I got an imported round graphic and would like to add so actionscript so that when i click the graphic it will go to xxx frame.
I tried the on (press) command it said this only use in button instances.How can I make this in graphic instances??
View Replies !
View Related
Tarhetting Multpe Instances For A 'setProperty' Action
IS it possible to list several instances to be affected by a get property, eg:
setProperty ("home", _alpha, "80");
setProperty ("tv", _alpha, "50");
setProperty ("comp", _alpha, "50");
setProperty ("links", _alpha, "50");
setProperty ("shop", _alpha, "50");
Here just end up with one setProperty action
View Replies !
View Related
Making Button Instances In An Action Script Menu
Hiya,
im using Flash MX, and im rather new to it. I d/l'd a sample menu here and wanted to edit it for my own site. I forgot who created it tho so i cant find it unless i search thru all the samples... thats alot, so ill just link to the fla here.
The thing is that this menu has links, that i want to open a html in a frame below the one this menu is in. But the links arent button instances so the 'on release geturl' blabla doesnt work.
I read somewhere i could post code here, so...
stop();
function createMenu(names, targets, labels, x, y) {
this.itemName = names.split(",");
this.itemTarget = targets.split(",");
this.frameLabel = labels.split(",");
_root.menuBase.duplicateMovieClip("menu_1", 1);
this._x = x;
this._y = y;
for (i=1; i<=this.itemName.length; i++) {
this.attachMovie("menuItem", "menuItem_"+i, i);
this["menuItem_"+i].name = this.itemName[i-1];
this["menuItem_"+i].itemTarget = this.itemTarget[i-1];
this["menuItem_"+i].frameLabel = this.frameLabel[i-1];
//this["menuItem_"+i].buttonover._width = this.itemName[i-1].length;
this["menuItem_"+i]._width = this.itemName[i-1].length*10;
if (i>1) {
this["menuItem_"+i]._x = this["menuItem_"+(i-1)]._x+(this["menuItem_"+(i-1)]._width)/2+(this["menuItem_"+i]._width)/2;
}
}
}
function createsubMenu(names, targets, labels, x, y) {
this.itemName = names.split(",");
this.itemTarget = targets.split(",");
this.frameLabel = labels.split(",");
_root.submenuBase.duplicateMovieClip("menu_1", 1);
this._x = x;
this._y = y;
for (i=1; i<=this.itemName.length; i++) {
this.attachMovie("menuItem", "menuItem_"+i, i);
this["menuItem_"+i].name = this.itemName[i-1];
this["menuItem_"+i].itemTarget = this.itemTarget[i-1];
this["menuItem_"+i].frameLabel = this.frameLabel[i-1];
//this["menuItem_"+i].buttonover._width = this.itemName[i-1].length;
this["menuItem_"+i]._width = this.itemName[i-1].length*10;
if (i>1) {
this["menuItem_"+i]._x = this["menuItem_"+(i-1)]._x+(this["menuItem_"+(i-1)]._width)/2+(this["menuItem_"+i]._width)/2;
}
}
}
_root.menu.createMenu = createMenu;
_root.menu.resetMenu = resetMenu;
_root.menu.createMenu("Home,About Us,Contact,Inventory", "_root,_root,_root,_root", "main,aboutus,contact,inventory", 50, 8);
link to .fla: http://members.home.nl/nio/menu.fla
I want to change the names of the items in the list. (home, about us, contact etc.) and probably the number of items. And the names of the submenu items. I can do that, but the menu doesnt work anymore then. I also want (i want alot:P) to be able to change the menu items that have a submenu..
And have those menu items, and submenu items, actually open something in a frame below the one this menu is in.
Any help/advice/pointers in the right direction would be greatly appreciated :-)
//kabooomi
[Edited by kaboomi on 07-21-2002 at 11:36 PM]
View Replies !
View Related
Changing Graphic Symbol Instances From Action Script
FLASH MX
1) ACTION SCRIPT INSTANCE SWAPS
I have a little movie clip that zooms a picture in and out. I want to play the movie clip over and over but with a different image each time a button is clicked. Will I be able to do the equivalent of the SWAP INSTANCE button?
2) BROKEN TWEENS
I wonder if this will be appropriate anyway as I have trouble changing it by hand as it breaks the TWEEN I have between 2 keyframes using the same symbol, a small version going to a big version.
3) NUMERIC RESIZES
Nightmare anyways as my version of Flash won't allow me to change an instance size to 3000 pixels, I get an INVALID SIZE AND POSITION error but I can use the SCALE TOOL to get there with a lot of faffing about.
This is all driving me spare, any suggestions. )c8
View Replies !
View Related
Action Script In Child Movie Clips, Instances, Symbols( Problem)
Hi,
Have come across a problem when trying to use action script in a movie clip symbol (created in the Library) and using an instance in a layer in the main move.
The action script which is in the movie clip instance seems to work differently to how it would if the exact same code was in a script layer in the main time line (or u could say that is doesn't work the the way it should).
I have 2 examples of this:
- XML.load(); loads but does not parse (ie load xml into DOM), yet returns success = true in the onLoad call back.
- scope of Array objects seems to be limited. That is an array (in this case containing the XML) is not accessible from the next frame. or rather does not exist in the next frame. Trying to assign this array to a globaly declared array results in a zero length array.
has anybody come across this before? if so is this a known problem or am i doing something wrong?
thanks
View Replies !
View Related
Adding Action To Buttons?
Ok, I found a cool tutorial on adding actions to buttons but its for Flash 4, and Im using flsh 5 so its confusing. I just want that when you mouse over the button, a little box or something goes around it, and then when you click on it, it takes you to the url. Can someone please explain to me in really easy terms for a very new newbie how to do this? Thanks.
View Replies !
View Related
Adding .jpg With Action Script
I want to load a jpeg into an instance of a movie clip. I looked in the tutorials and found this: function previousSlide (firstSlide,lastSlide,slideName,slideText) {
i = i-1;
newSlide = slideHolder.loadMovie(slideName + i + ".jpg");
newText = loadVariablesNum(slideText + i + ".txt", 0);
_root.newSlide;
_root.newText;
}
I have tried this over and over using my code and can not get it to work. My code is pic.loadMovie("ur3.jpg");
I have an instance of a blank movie clip named pic on the main timeline. If I change the name of the file called I recieve Error opening URL "file:///C|/Documents%20and%20Settings/bcunningham/Desktop/documents/TRANSFER/pictures/ur.jpg"
So I know it enters the loadMovie because I do not get that when I have an actual file named ur3.jpg in the correct directory. Any help would be greatly appreciated.
View Replies !
View Related
Adding Sound To An Action
I'm using Flash 5.
What I want to do is add sound to an action, an example listed below.
if(mMon==24){
Play this sound
}
if(mMon==43){
Play another sound
}
if(mMon==88){
Play another sound
}
What code do I need to use to make it work? Sounds are *.wav files.
Any help would be great.
Thanks
View Replies !
View Related
Adding A PHP Tag To The GetURL Action?
Hello, you all. I have a question for all you action-script guru’s because I do not have a clue!
The Marketing dept. here at work have decided they need track clicks from webmasters having unique ID numbers from the existing Flash nav. Say that a surfer arrives at a page from an address such as:
http://www.somesite.com/index.html?revid=1014
To include this extension to a normal HTML anchor tag, it would look like so:
<A HREF="join.html<? revid(); ?>"onClick="exit=false"></A>
Originally, one of the Flash nav links simply stated;
on (release) {
getURL("join.html");
}
Including this to my existing Flash navigation via the getURL action, I learned is a different story! The output window shows errors up-the-yang.
on (release) {
getURL("join.html<? revid(); ?>, onClick=exit=false");
}
This did not work too well!
So, the questions are…where does one include this nested PHP tag in the actionScript? Also, where…and how to include the exit pop-up script, "onClick="exit=false?"
Could someone PLEASE school me?
Thank you so much!
Dorian~
View Replies !
View Related
Adding Conditional Action
I have created a telephone keypad in a learning module for users to practice calling our hospital emergency number, ext. 5555.
With rollover the #5 highlights to red.
Upon release I have added a wave file for the sound of the #5 on a touch tone keypad.
Now I would like to add a script that once they have clicked on the number 5 four times, applause or some exclamation of success will play. I want this to only occur if they actually dial the full extension.
I am struggling with the code. Any suggestions? I am using MX 2004.
Thanks.
View Replies !
View Related
Adding Action To XML Menu
Hello,
I was wondering if anybody would be kind enough to assist me with my actionscript problems. I have acquired a component XML Menu from a site and a tutorial on preloading and transitioning dynamic files. The problem that I am having is that I have no idea on how to link these two items. On the tutorial page, they tell me to make an actions layer and add the following code:
code: b1.onRelease = function() {
if (_root.section != "profile.swf") {
_root.section = "profile.swf";
_root.transition.gotoAndPlay("closing");
}
};
b2.onRelease = function() {
if (_root.section != "gallery.swf") {
_root.section = "gallery.swf";
_root.transition.gotoAndPlay("closing");
}
};
b3.onRelease = function() {
if (_root.section != "photos.swf") {
_root.section = "photos.swf";
_root.transition.gotoAndPlay("closing");
}
};
That code obviusly is for the basic buttons on the tutorial but I what I need is for the tutorial's loading and transitioning to be triggered by the XML Menu.
Here is the code for the XML menu (theres more but I believe this is the only relevant part):
code: //--------------------------------------------------
#initclip 1
CollapseButtonClass = ProtoLinkClass();
CollapseButtonClass.inheritFrom(MovieClip);
Object.registerClass("CollapseButton", CollapseButtonClass);
CollapseButtonClass.prototype.init = function() {
if (!this.alpha) {
this.alpha = {start:0, top:100, bottom:0};
}
this.yinactive = this._y;
this.y = this.yinactive;
this.bgObjParams = {width:this.parent._width_, height:this.parent._height_, colourthis.butType == 'secondary') ? (this.parent.sColour) : (this.parent.pColour), alpha:this.alpha.top, resize:false, applyColour:true};
this.txtObjParams = {x:1, y:1, w:this.parent._width_ - 20, h:this.parent._height_ - 0, applyBground:false, applyFocus:true, title:String(this._name), applyIndentthis.butType == 'secondary') ? (true) : (false)};
this.id = this.attachMovie("Rectangle", "bg", 1, this.bgObjParams);
this.id = this.attachMovie("TextBox", "txt", 2, this.txtObjParams);
this.active = false;
this.enabled = true;
};
CollapseButtonClass.prototype.onSignal = function() {
if (this.enabled) {
if (!this.active) {
this.butType == 'secondary' ? this.bg.setColour(this.parent.sColour) : this.bg.setColour(this.parent.pColour);
var newOpacity = Mouse.isWithin(this, true) ? this.alpha.top : this.alpha.bottom;
this.bg._alpha = Math.approach(this.bg._alpha, newOpacity);
} else {
this.bg.setColour(this.parent.aColour);
}
if (this._y <> this.y) {
this._y = Math.approach(this._y, this.y);
}
}
};
CollapseButtonClass.prototype.onMouseUp = function() {
if (Mouse.isWithin(this, true)) {
this.parent.sID.playSound(this.butType);
if (this.butType == 'primary') {
this.parent.activateObj(this.uid);
if (this.butAction != null) {
trace("Action specified in XML: " + this.butAction);
}
} else if (this.butType == 'secondary') {
trace("Action specified in XML: " + this.butAction);
}
}
};
#endinitclip
//==================================================
I am not sure if it will be helpful but, here is the sample XML file:
Quote:
<menu>
<item name="Menu1" action="loadClip">
</item>
<item name="Menu2" action="loadClip">
<sub name="SubMenu1" action="loadClip"></sub>
<sub name="SubMenu2" action="loadClip"></sub>
</item>
<item name="Menu3" action="loadClip">
<sub name="SubMenu3" action="loadClip"></sub>
<sub name="SubMenu4" action="loadClip"></sub>
<sub name="SubMenu5" action="loadClip"></sub>
<sub name="SubMenu6" action="loadClip"></sub>
<sub name="SubMenu7" action="loadClip"></sub>
</item>
<item name="Menu4" action="loadClip">
<sub name="SubMenu8" action="loadClip"></sub>
<sub name="SubMenu9" action="loadClip"></sub>
</item>
<item name="Menu5" action="loadClip">
</item>
<item name="Menu6" action="loadClip">
</item>
</menu>
Thanks in advance to anybody willing to help.
View Replies !
View Related
Adding Action To Combo Box
hi,
is it possible to add actions to combox box values?
for eg.
when i choose "Option 1" --> gotoAndPlay (20);
when i choose "Option 2" --> gotoAndPlay (25);
when i choose "Option 3" --> this.selection.gotoAndPlay (1);
so that it act like a drop down menu....
i really appreciate the help anybody can rendered.
thanks a million.
View Replies !
View Related
[F8] Help Adding An Action To A For Loop
Ive been trying to figure this out for hours and it is driving me crazy. I need to add a different gotoAndPlay action to each instance of 'a'. I can figure out how to add the same gotoAndPlay action to each one but how to I add a different action to each? Any help would be much appreciated.
code:
_global.t_depth = 1;
t_mcs = [t_ele, t_u, t_c, t_a, t_s, t_m, t_o, t_t, t_t2, t_t2b, t_a2];
for (a=0; a<t_mcs.length; a++) {
t_mcs[a].scaleTo(50, 1, "easeOutElastic");
t_mcs[a].onRollOver = function() {
this.scaleTo(100, 0.5, "easeOutElastic");
t_depth += 1;
this.swapDepths(t_depth);
};
t_mcs[a].onRelease = function() {
variable = t_mcs[a];
_root.gotoAndPlay("variable");
};
t_mcs[a].onRollOut = t_mcs[a].onReleaseOutside=function () {
this.scaleTo(50, 1, "easeOutElastic");
};
}
View Replies !
View Related
Adding Action To MC From Within Class
Hi all,
I've got a problem with an actionscript class - basically within the class I attach a movie clip, to which I need to add an onRelease action. I've added a trace action in the code below (see the red lines), but what I really need to do is pass it a property of the class (namely the target...) which I know is out of scope... but there must be some way to pass it... Help, I'm going nuts here... I tried setting the action from outside ie.
preview1.myMC.onRelease = function(){
trace(preview1.myTarget);
}
which doesn't work at all.
Is there any way of passing a reference to the object? I tried completely rewriting the code, associating the class IconPreview with the preview movie clip in the library and instantiating it by attaching movie instead of declaring a new class, but then I had other weird problems, like the setInterval not firing for a start, and trying to apply the action to the whole IconPreview object didn't work either.
I'm completely out of patience with this. Any help *greatly* appreciated...
The bones of the code is this:
/****************** preview class ****************/
class IconPreview{
// declare variables
private var iconImage:String;//the image for the preview
private var order:Number;//page one, page two etc.
private var double:Boolean;//double page or single
private var isOn:Boolean;//whether its' the current preview
static var container:MovieClip;//containing element
static var spacing:Number; //space between one preview and another
public var myMC:MovieClip;
private var t;//interval
private var imageLoaded:Boolean;
public var myTarget:String;
// constructor
function IconPreview(piconImage:String, porder:Number, pdouble:Boolean, pmyTarget:String){
this.iconImage = piconImage;
this.order = porder;
this.double = pdouble;
this.myTarget = pmyTarget;
this.isOn = false;//all switched off at start
container = _root.previewContainer;
spacing = 5;
this.myMC = _root.previewContainer.attachMovie("preview", ["preview"+this.order], _root.previewContainer.getNextHighestDepth());
this.t = null;
this.imageLoaded = false;
this.createClip();
}
function createClip(){
this.myMC._alpha = 0;
this.myMC.loadMovie(iconImage);
this.t = setInterval(this, "positionMC", 500);
}
// position the mc
function positionMC(){
if(this.myMC._height!=0){//not loaded
this.imageLoaded = true;
this._height = myMC._height;
this._width = myMC._width;
clearInterval(this.t);
var yPos = spacing;
yPos += ((myMC._height + spacing)*(this.order-1));
var xPos = (container._width - this.myMC._width)/2;
this.myMC._x = xPos;
this.myMC._y = yPos;
this._x = myMC._x;
this._y = myMC._y;
//set actions - have to use function literals
//as the MC hasn't got access to methods of the class
//fade up
this.myMC.onEnterFrame = function(){
if(this._alpha < 100){
this._alpha +=5;
}else{
this.onEnterFrame = null;//clear action
}
trace(this._alpha);
}
this.myMC.onRelease = function(){
trace("hello - released");
}
}
}
}
View Replies !
View Related
Adding A Frame Action
I have just started using Adobe Flash, having used Macromedia Flash for some time to do simple animations/movies. I have been trying to add a simple Frame Action to a keyframe which in Macromedia Flash simply required clicking on the keyframe required and going into Actions from the menu bar. From here, you simply clicked on the plus sign to add an action and then I selected the Movie Control>Stop action. This then gave me a symbol at the frame I wanted to indicate the action.
This simple action does not seem to be the same procedure in Adobe Flash, when I go into actions and click on the plus sign it brings up a whole list of actions that are not relevant to what I am wanting. Can anyone tell me how I simply add the action to stop an action during a movie, which as noted above is simply Movie Control>Stop action in Macromedia Flash.
Any help appreciated.
Michelle
View Replies !
View Related
Adding Some Action To The Buttons
Hi!
i got a video online with a preloader. It's made simply and looks like that:
loader.autoLoad = false;
loader.contentPath = "videoname.swf";
pBar.source = loader;
loader.load();
pBar.complete = function() {
this._visible = false;
};
now i want to add some buttons to "jump" to specific frames. I add some buttons and add actionscript like that:
on (click) {
this._parent.gotoAndPlay("250");
}
hmmm, but it doesn't work. how can i specify the name of the video? i think that the problem is, he doesn't know this._parent
Somebody an idea?
Thx,
Dorian
View Replies !
View Related
Adding Action To XML Menu
Hello,
I was wondering if anybody would be kind enough to assist me with my actionscript problems. I have acquired a component XML Menu from a site and a tutorial on preloading and transitioning dynamic files. The problem that I am having is that I have no idea on how to link these two items. On the tutorial page, they tell me to make an actions layer and add the following code:
ActionScript Code:
b1.onRelease = function() {
if (_root.section != "profile.swf") {
_root.section = "profile.swf";
_root.transition.gotoAndPlay("closing");
}
};
b2.onRelease = function() {
if (_root.section != "gallery.swf") {
_root.section = "gallery.swf";
_root.transition.gotoAndPlay("closing");
}
};
b3.onRelease = function() {
if (_root.section != "photos.swf") {
_root.section = "photos.swf";
_root.transition.gotoAndPlay("closing");
}
};
That code obviusly is for the basic buttons on the tutorial but I what I need is for the tutorial's loading and transitioning to be triggered by the XML Menu.
Here is the code for the XML menu (theres more but I believe this is the only relevant part):
ActionScript Code:
//--------------------------------------------------
#initclip 1
CollapseButtonClass = ProtoLinkClass();
CollapseButtonClass.inheritFrom(MovieClip);
Object.registerClass("CollapseButton", CollapseButtonClass);
CollapseButtonClass.prototype.init = function() {
if (!this.alpha) {
this.alpha = {start:0, top:100, bottom:0};
}
this.yinactive = this._y;
this.y = this.yinactive;
this.bgObjParams = {width:this.parent._width_, height:this.parent._height_, colour:(this.butType == 'secondary') ? (this.parent.sColour) : (this.parent.pColour), alpha:this.alpha.top, resize:false, applyColour:true};
this.txtObjParams = {x:1, y:1, w:this.parent._width_ - 20, h:this.parent._height_ - 0, applyBground:false, applyFocus:true, title:String(this._name), applyIndent:(this.butType == 'secondary') ? (true) : (false)};
this.id = this.attachMovie("Rectangle", "bg", 1, this.bgObjParams);
this.id = this.attachMovie("TextBox", "txt", 2, this.txtObjParams);
this.active = false;
this.enabled = true;
};
CollapseButtonClass.prototype.onSignal = function() {
if (this.enabled) {
if (!this.active) {
this.butType == 'secondary' ? this.bg.setColour(this.parent.sColour) : this.bg.setColour(this.parent.pColour);
var newOpacity = Mouse.isWithin(this, true) ? this.alpha.top : this.alpha.bottom;
this.bg._alpha = Math.approach(this.bg._alpha, newOpacity);
} else {
this.bg.setColour(this.parent.aColour);
}
if (this._y <> this.y) {
this._y = Math.approach(this._y, this.y);
}
}
};
CollapseButtonClass.prototype.onMouseUp = function() {
if (Mouse.isWithin(this, true)) {
this.parent.sID.playSound(this.butType);
if (this.butType == 'primary') {
this.parent.activateObj(this.uid);
if (this.butAction != null) {
trace("Action specified in XML: " + this.butAction);
}
} else if (this.butType == 'secondary') {
trace("Action specified in XML: " + this.butAction);
}
}
};
#endinitclip
//==================================================
I am not sure if it will be helpful but, here is the sample XML file:
Quote:
<menu>
<item name="Menu1" action="loadClip">
</item>
<item name="Menu2" action="loadClip">
<sub name="SubMenu1" action="loadClip"></sub>
<sub name="SubMenu2" action="loadClip"></sub>
</item>
<item name="Menu3" action="loadClip">
<sub name="SubMenu3" action="loadClip"></sub>
<sub name="SubMenu4" action="loadClip"></sub>
<sub name="SubMenu5" action="loadClip"></sub>
<sub name="SubMenu6" action="loadClip"></sub>
<sub name="SubMenu7" action="loadClip"></sub>
</item>
<item name="Menu4" action="loadClip">
<sub name="SubMenu8" action="loadClip"></sub>
<sub name="SubMenu9" action="loadClip"></sub>
</item>
<item name="Menu5" action="loadClip">
</item>
<item name="Menu6" action="loadClip">
</item>
</menu>
Thanks in advance to anybody willing to help.
View Replies !
View Related
Adding Some Action To The Buttons
Hi!
i got a video online with a preloader. It's made simply and looks like that:
loader.autoLoad = false;
loader.contentPath = "videoname.swf";
pBar.source = loader;
loader.load();
pBar.complete = function() {
this._visible = false;
};
now i want to add some buttons to "jump" to specific frames. I add some buttons and add actionscript like that:
on (click) {
this._parent.gotoAndPlay("250");
}
hmmm, but it doesn't work. how can i specify the name of the video? i think that the problem is, he doesn't know this._parent
Somebody an idea?
Thx,
Dorian
View Replies !
View Related
Adding A PHP Tag To The GetURL Action?
Hello, you all. I have a question for all you action-script guru’s because I do not have a clue!
The Marketing dept. here at work have decided they need track clicks from webmasters having unique ID numbers. Whereas a normal HTML anchor tag would contain this line;
<A HREF="join.html<? revid(); ?>"onClick="exit=false"></A>
Originally, one of the Flash nav links simply stated;
on (release) {
getURL("join.html");
}
Including this to my existing Flash navigation via the getURL action, I learned is a different story! The output window shows errors up-the-yang.
on (release) {
getURL("join.html<? revid(); ?>, onClick=exit=false");
}
This did not work too well!
So, the questions are…where does one include this nested PHP tag in the actionScript? Also, where…and how to include the exit pop-up script, "onClick="exit=false?"
Could someone PLEASE school me?
Thank you so much!
Dorian~
View Replies !
View Related
Adding A Simple Action To Object (CS3)
Hello,
For frame of reference.. I havent used Flashe since before Studio 8, I just got Adobe Flash CS3.
All I want to do is create an object that when clicked on will GoTo a new Frame in the Scene.
I set this up the way I used to in older Flash versions, and when i click on the object to set an Action I get an error saying: "Current Selection Can Not Have Actions Applied to it"
Have they completely changed the way this works?
Any tutorials or sample FLAs on creating a simple On Press GoTo Frame would be great!
thanks
View Replies !
View Related
Adding Action To Dynamic Menu
Hello all,
I've asked about this piece of actionscript before and gotten very good help. I'm pretty close to understanding what happens. I can see how the menu is setup and all. There is just one thing I don't see yet.
Where in this script are the actions attached to the menu-items. I can't seem to figure that out. Can anybody else see it?
Dynamic List
Initial Setup (Don’t Change)
function setUpList() {
with (mcList) {
with (mcListTitle) {
txtListTitle.text = itemsA.listTitle;
txtListTitle.autoSize = true;
bigW = _width;
}
with (mcPart0) {
mcListText.txtItem.text = itemsA[0].labelText;
mcListText.txtItem.autoSize = true;
lastY = _y;
}
myDepthM = 5;
intY = _y;
intW = mcListBG._width;
intHeight = mcListBG._height;
if (mcListTitle._width>mcPart0._width) {
bigW = mcListTitle._width;
} else {
bigW = mcPart0._width;
}
}
buildList();
}
Distance Between Menu Items
////// **** change number to how many pixels you want between menu items
////// **** default is 25
ySpace = 20;
//////////////////////////////////////////////////////////////////////
////////////////////// MENU BUILD (DON'T CHANGE) ///////////////////
function buildList() {
for (i=1; i<itemsA.length; i++) {
duplicateMovieClip(mcList.mcPart0, "mcPart"+i, myDepthM++);
with (mcList["mcPart"+i]) {
_y = lastY+ySpace;
mcListText.txtItem.text = itemsA[i].labelText;
mcListText.txtItem.autoSize = true;
lastY = _y;
myW = _width;
}
if (myW>bigW) {
bigW = myW;
}
}
with (mcList) {
topHeight = mcListTop._height;
mcListTop._width = bigW+40;
with (mcListBG) {
_width = bigW+40;
_height = lastY;
bgHeight = _height;
}
with (mcListBGBottom) {
_y = bgHeight+topHeight-3;
mcRect._width = bigW+40-(mcCornerL._width*2);
mcCornerR._x = mcRect._width+(mcCornerL._width*2);
}
_x = _x-(bigW-intW);
}
listButtons();
}
Menu List Buttons Code
**** minNameLength = mcPart0 length
minLNameLength = 7;
animNum = 0;
function listButtons() {
for (i=0; i<itemsA.length; i++) {
mcList["mcPart"+i].onRelease = function() {
if (goToView != 99) {
myLastClickedNum = myClickedNum;
}
clicked = 0;
for (j=0; j<=2; j++) {
mcPopUp["mcPart"+j].gotoAndStop(1);
}
mcPopUp["mcPart"+clicked].gotoAndStop(2);
nLLength = this._name.length;
getLNum(this._name);
myClickedNum = myLNum;
trace(myLastClickedNum+"myLastClickedNum 1");
trace(myClickedNum+"myClickedNum 1");
listClicked(myClickedNum);
};
mcList["mcPart"+i].onRollOver = function() {
nLLength = this._name.length;
getLNum(this._name);
mcList["mcPart"+myLNum].gotoAndStop(2);
};
mcList["mcPart"+i].onRollOut = function() {
nLLength = this._name.length;
getLNum(this._name);
for (j=0; j<=itemsA.length; j++) {
if (j != myClickedNum) {
mcList["mcPart"+j].gotoAndStop(1);
}
}
};
}
}
function getLNum(which) {
if (nLLength == minLNameLength) {
myLNum = mcList[which]._name.substring(nLLength-1, nLLength);
} else {
myLNum = mcList[which]._name.substring(nLLength-2, nLLength);
}
return (myLNum);
}
View Replies !
View Related
Adding Action To Buttons On Navigation Bar
I have a flash template, the fla and the swf. I want to edit the buttons to point to the correct pages. I have cllicked on the buttons and did an edit, then in the action pointed the the index.html made it the _parent, locked the button. My problem is it is not going to the index page.
Is there something else I need to do? I am using Flash 8 and when I check the properties for the action script if is 1.0. When I change it to 2.0 I get the following error:
encountered
getURL(/:url6);
Total ActionScript Errors: 6 Reported Errors: 6
Please help.
Thank you
Dee
View Replies !
View Related
Adding GetURL Makes Dissappear Action Not Run
Hi,
I am using Flash MX 2004 and I have a button that has the following action on it:
on (rollOver) {
gotoAndPlay(2);
}
on (rollOut) {
gotoAndPlay(16);
}
on (release) {
_root.gotoAndPlay("dissappear");
}
When I try to link to the URL by using:
getURL("a_About.htm", "_self");
so it looks like:
on (release) {
_root.gotoAndPlay("dissappear"),
getURL("index.htm", "_self");
}
The "dissappear" action (makes the button move right, left and fade out) doesn't happen even though the button goes to the right page. I want to keep the dissappear action and then go to the URL... I have tried every combination that I can think of (getURL before that action, after the action, within the action....) and nothing works. It keeps on linking immeadiately to the page but the disappear action is completely skipped.
Could anyone please point me in the right direction?
Thanks, MC
View Replies !
View Related
Need Action Script Help For Adding A Hyperlink To A Button
Hey there its been awhile since I've been here, but I came back because I have a simple question that could be answered quickly, but it has been bothering me for quite a while.
I have made a flash button and I have made it that when you press the button it plays a sound sounds way to easy right ? but the thing is though when I press the button I want it to play a sound and take the user to a specified webpage on my site, But I don't know the right action script code to generate or write out to make it work correctly or not at all......
Can someone please look at this code and tell me what I am doing wrong and also that code will be copied to 4 other buttons but will be a little modfied to go to other different webpages on my site.
[on (release) {
//Goto Webpage Behavior
getURL("http://sunflare2000.250free.com/darklightninghacks.htm//","_self");
//End Behavior]
Thanks for any help that you can provide for me
MadMikeXP
View Replies !
View Related
[F8] Adding Layers Over XML Photo Slideshow Action
I found some actionscript that I was able to use to create an xml photo slideshow. The problem is when I try to add another movie clip to use as texture above the photo's, it only works on the first frame and fades out.
It seems like once it sees the action to create the movie clips it ignores everything else in the timeline.
I have this action in the first frame on the first layer:
PHP Code:
// set random # variables - each must be 0 for first 'while' loop below
var randomNum = 0;
var randomNumLast = 0;
// parent container
var container_mc = this.createEmptyMovieClip("container",0);
// movie clip containers
container_mc.createEmptyMovieClip("loader1_mc",2);
container_mc.createEmptyMovieClip("loader2_mc",1);
// preload watcher
this.createEmptyMovieClip("watcher_mc",100);
// load xml
images_xml = new XML();
images_xml.ignoreWhite=true;
images_xml.onLoad = parse;
images_xml.load("images.xml");
function parse(success) {
if (success) {
imageArray = new Array();
var root = this.firstChild;
_global.numPause = Number(this.firstChild.attributes.timer * 1000);
_global.order = this.firstChild.attributes.order;
_global.looping = this.firstChild.attributes.looping;
_global.fadetime = Number(this.firstChild.attributes.fadetime);
_global.xpos = Number(this.firstChild.attributes.xpos);
_global.ypos = Number(this.firstChild.attributes.ypos);
var imageNode = root.lastChild;
var s=0;
while (imageNode.nodeName != null) {
imageData = new Object;
imageData.path = imageNode.attributes.path;
imageArray[s]=imageData;
imageNode = imageNode.previousSibling;
s++;
}
// place parent container
container_mc._x = _global.xpos;
container_mc._y = _global.ypos;
// parse array
imageArray.reverse();
imageGen(imageArray);
} else {
trace('problem');
}
}
// depth swapping
function swapPlace(clip,num) {
eval(clip).swapDepths(eval("container_mc.loader"+num+"_mc"));
}
function loadImages(data,num) {
if (i==undefined || i == 2) {
i=2;
createLoader(i,data,num);
i=1;
} else if (i==1) {
createLoader(i,data,num);
i=2;
}
}
function createLoader(i,data,num) {
thisLoader=eval("container_mc.loader"+i+"_mc");
thisLoader._alpha=0;
thisLoader.loadMovie(data[num].path);
watcher_mc.onEnterFrame=function () {
var picLoaded = thisLoader.getBytesLoaded();
var picBytes = thisLoader.getBytesTotal();
if (isNaN(picBytes) || picBytes < 4) {
return;
}
if (picLoaded / picBytes >= 1) {
swapPlace("container_mc.loader2_mc",1);
alphaTween = new mx.transitions.Tween(thisLoader, "_alpha", mx.transitions.easing.Regular.easeOut,0,100,_global.fadetime,true);
timerInterval = setInterval(imageGen,_global.numPause,data);
delete this.onEnterFrame;
}
}
}
function imageGen(data) {
// random, or sequential?
if (_global.order=="random") {
// choose random # between 0 and total number of images
while (randomNum == randomNumLast) {
randomNum = Math.floor(Math.random() * data.length);
trace(randomNum);
}
loadImages(data,randomNum);
randomNumLast = randomNum;
} else if (_global.order=="sequential") {
// start at 0, increment to total number of images, then drop back to zero when done
if (p==undefined || p==data.length && _global.looping=="yes") { p=0; } else { break; }
loadImages(data,p);
p++;
} else {
trace ("order attribute in xml isn't correct - must specify either 'random' or 'sequential'");
}
clearInterval(timerInterval);
}
stop();
I created another movie clip on the 2nd layer of the first frame.
How should I reconfigure this so that both movie clips play at the same time?
View Replies !
View Related
Adding On Button Click Action From Within A Loop?
Hello, I am quite new to as3 and I really cannot figure out how to do this.
This script i made loads all of my images really nicely into my scrollpane
Then when i click on the image it returns:
undefined
[object Loader]
For every image, it has a unique materialID (from my database), so i want to make a textbox this value when i click on an image.
But the eventhandler does not seem to know which image it has clicked! I really don't understand why not, I thought it would store the current value of evt.target.data["Material"+i] when clicked
But it just returns [object Loader], instead of the value of evt.target.data["Material"+i] ("12345", for example)
Is it possible to pass a unique value for each image i load to the clickhandler function? so when i click on an image, the textbox on the scence changes to the name of that image..
Please give any advise..
Code:
var myLoader:URLLoader = new URLLoader()
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES
myLoader.load(new URLRequest("http://www.mydomain.com/materials.php"))
myLoader.addEventListener(Event.COMPLETE, onDataLoad)
myLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError)
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError)
myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus)
var holder:Sprite = new Sprite();
var p:Array = new Array();
var hor = -100
var ver = 10
var rows = 0
var howmanyloaded = 0
var lasttoload = 0
function onDataLoad(evt:Event){
var thestage = 0.2
var count = evt.target.data.count
lasttoload = count - 2
trace(lasttoload)
var imagetoload = Math.round(lasttoload * thestage)
for(var i:uint=0; i<evt.target.data.count; i++){
p[i] = new Loader();
p[i].load(new URLRequest("http://www.mydomain.com/products/pics/"+evt.target.data["Material"+i]+".jpg"));
//trace(evt.target.data["Material"+i])
//preloading stuff, will work on fixing later today
//p[i].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
//p[i].contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
holder.addChild(p[i]);
p[i].addEventListener(MouseEvent.CLICK, clickHandler)
//my genius way to avoid having to do the maths. haha
if(rows==4){
rows = 0
hor = -100
ver = ver + 110
} else {
hor = hor + 110
rows++
//ver = ver + 0
}
p[i].x = hor
p[i].y = ver
function clickHandler(event:MouseEvent):void {
trace(evt.target.data["Material"+i]);
trace(event.target);
}
}
}
//error callbacks
function onIOError(evt:IOErrorEvent){
trace("IOError: "+evt.text)
}
function onHTTPStatus(evt:HTTPStatusEvent){
//trace("HTTPStatus: "+evt.status)
}
function onSecurityError(evt:SecurityErrorEvent){
trace("SecurityError: "+evt.text)
}
////i have just temporarily added a timer here, because the scrollpane does not scroll unless i add the mc when it's already filled
//will have to tie this into the preloading, attach mc to pane when it is done preloading.
var timer:Timer = new Timer(7000, 1);
timer.addEventListener(
TimerEvent.TIMER,
function(evt:TimerEvent):void {
pane.source = holder;
trace("attached")
}
);
timer.start();
View Replies !
View Related
Adding Properties To An Action Script Object
I wish to add custom properties to a movie clip object. I have attempted the following:
Code:
function makeClip(pic:String) {
var mc:MovieClip;
mc=mcSA.attachMovie("mcThumb","tn"+ pCount,mcTS.mcSA.getNextHighestDepth());
mc.tnWidth=pic.tnWidth;
mcl.loadClip(String(pic.thumbnail),"mcSA.tn"+ pCount);
return;
}
mc.tnWidth does not retain the value assigned. Does attachMovie return only a copy of the movieclip?
Thanks!
View Replies !
View Related
Action Script For Adding XML Element Or Attribute
I was following a tutorial on the Adobe developer network that is a video playlist being populated by an XML file. I'm new to using XML and I'm kind of stumped and I was hoping someone would help me. I would like to add another element or attribute to the XML file but how do I call it in the Action Script?
AS3>>>There is a class constructor and a method which loads the XML data which in turn loads another method ('initMediaPlayer') below which is what is going through the XML nodes :
Code:
public function initMediaPlayer(event:Event):void {
var myXML:XML = new XML(xmlLoader.data);
var item:XML;
for each (item in myXML.vid) {
// populate playlist.
// Get thumbnailnail value and assign to cellrenderer.
var thumbnail:String;
if (item.hasOwnProperty("@thumbnail")>0) {
thumbnail = item.@thumbnail;
}
// Send data to tileList.
tileList.addItem({label:item.attribute("description").toXMLString(),
data:item.attribute("src").toXMLString(),
source:thumbnail});
}
XML file looks like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<playlist id="My Video Player" >
<vid description="Lorem ipsum dolor sit amet"
src="movies/myMovie.flv"
thumbnail="thumbnails/smallPic.jpg" />
</playlist>
So now I would like to add another attribute or element
Code:
<?xml version="1.0" encoding="UTF-8"?>
<playlist id="My Video Player" >
<vid description="Lorem ipsum dolor sit amet"
details="consectetuer adipiscing elit. Maecenas quis nunc"
src="movies/myMovie.flv"
thumbnail="thumbnails/smallPic.jpg" />
</playlist>
How do I modify the AS....or does anyone know of a tutorial out there. Thanks.
View Replies !
View Related
Action Script 3 And Adding Code To Buttons
When I open a new doc and selct action script 3 it won't allow me to insert code by selcting the button on the stage. It does if I select action script 2. All my old pages update ok but if I make new buttons it wont take the code. CAn someone tell me what is going on???
Thanks a lot
View Replies !
View Related
|