See Related Forum Messages: Follow the Links Below to View Complete Thread
Adding Actions To Attached Clips
I have attached movie clip to _root and made prototype to use with it. Here is code:
on (release) {
MovieClip.prototype.xy = function() {
with (this) {
_x = 100;
_y = 100;
}
};
_root.attachMovie("clip1", "clip2", 0);
_root.clip2.xy();
}
My question is: How to assign action (on roll over,on roll out, on release...) to this movie clip?
(Using flash MX)
Adding Events To Dynamically Attached MC
hii every one.
I have one doubt. i have jus started to work in flash.
I have done a sample in which there will be a main stage (movie) and a few icons by the side of it.
Icons on the side can be dragged and dropped on the main stage. (for that i have duplicated the icon and dragged it.) after placing the icon, it is attached to the main stage and it can be moved only with the main stage.
am able to achieve this with some excellent guidance from members of this forum.
Now the requirement is that i have to load all the icons dynamically.
Previously all coding was written for the icon itself. now as am loading external icons (swf or jpgs), how can i get all the events attached to that dynamically loaded icon
any help would be great
thanks
Adding Functions To Attached Movies?
I was wondering if someone could explain the best way to dynamically assign onRelease functions to movie clips added to the stage with attachMovie.
I currently have a script which reads in data from an XML file which contains file names for images. The XML has 2 nodes one for thumbnail images and one for the corresponding larger images.
Currently the script dynamically attaches movie clips to the stage and loads a thumbnail into each one using a for loop.
I now need to know how to add a unique onRelease function to each thumbnail which will read in the path to the larger image and ultimately display it. I have found a work around where i get each clip to getDepth and use that value to retrieve the image name from an array however I'm hoping there is an easier way to do this.
Hope that makes sense.
Adding Events To An Attached Movie?
Hi,
I've look all over and can't seem to find something to work for what I'm doing. I have an xml file being pulled into a photo gallery that runs a slideshow along with the option of thumbnails below it. I got the slideshow working great and the thumbnails show up, but my problem is I can't seem to figure out how to assign events to the thumbnails, like onrelease for example. Never works. Here's my code.
ActionScript Code:
function loadThumbs(images_xml,startX,startY,thumbsPerRow,lrPad,tbPad) {
// Defaults
if(!startX) { var startX = 0; }
if(!startY) { var startY = 0; }
if(!rows) { var rows = 0; }
if(!lrPad) { var lrPad = 0; }
if(!tbPad) { var tbPad = 0; }
// Setup
var thumbWidth:Number = 130;
var thumbHeight:Number = 97;
// Grid setup
var nbrPosInit:Array = [startX, startY];
var nbrColMax:Number = thumbsPerRow;
var nbrIcr:Array = [lrPad, tbPad];
// XML Parsing
var nodes = images_xml.firstChild.childNodes;
numThumbs = nodes.length;
for (var i = 0; i<numThumbs; i++) {
var t = _root.attachMovie("mc_thumb", "mc_thumb"+i, this.getNextHighestDepth());
// Grid positioning
t._y = Math.floor(nbrPosInit[0]+Math.floor(i/nbrColMax)*(nbrIcr[0]+thumbHeight));
t._x = Math.floor(nbrPosInit[1]+(i%nbrColMax)*(nbrIcr[1]+thumbWidth));
t.thumb = "thumbs/" + nodes[i].attributes.jpegURL;
t.onRelease = function() {
getURL("http://www.evanbartlett.com/", "_blank");
};
t.loadMovie(t.thumb);
trace(t.thumb);
}
}// End of function
Also 2 more things. Just so I understand it right. I can change the mc that the movies get attached in by changing the _root.AttachMovie to _root.mcname.AttachMovie right?
And also. I would like to attach another movie that centers both verticall and horizontally BEHIND each thumbnail. How would I go about that?
I hope someone out there can answer these 3 questions for me and get me on the right track. Thanks in advance!
Adding Easing To Attached Movie Clips
I've attached some MovieClips to the stage by looping through an array. (dreamarray) I'm trying now to add easing to each of these MovieClips. I found a tutorial, but can't seem to translate their tutorial over to my file. In the released() function...i am creating a temp variable "t" to hold each of my dream elements. The t.xPos and t.yPos are undefined when I trace them after clicking on them. I would appreciate any help!
Right now I have t.xPos = dream._x --- I'm sure this needs to be changed
import mx.utils.Delegate
import mx.transitions.Tween;
import mx.transitions.easing.*;
var numClouds:Number = 35;
var fl:Number = 250;
var gravity:Number = .5;
var vx:Number = 0;
var vy:Number = 0;
var vz:Number = 0;
var friction:Number = .97;
var vpX:Number = Stage.width / 2;
var vpY:Number = Stage.height / 2;
var vpY:Number = 400;
var home:MovieClip = this;
var dreamarray:Array = new Array();
dreamarray[0] = "dreamone";
dreamarray[1] = "dreamtwo";
dreamarray[2] = "dreamthree";
dreamarray[3] = "dreamfour";
dreamarray[4] = "dreamfive";
var dreamarrayX:Array = new Array();
dreamarrayX[0] = 0
dreamarrayX[1] = -1800;
dreamarrayX[2] = 2000;
dreamarrayX[3] = 100;
dreamarrayX[4] = -1700;
var dreamarrayZ:Array = new Array();
dreamarrayZ[0] = 0;
dreamarrayZ[1] = 500;
dreamarrayZ[2] = 1000;
dreamarrayZ[3] = 1500;
dreamarrayZ[4] = 2000;
function init() {
for (var i:Number = 0; i<dreamarray.length; i++) {
var dream:MovieClip = attachMovie(dreamarray, "dreamarray" + i, i);
//var dream:MovieClip = attachMovie("dreamone", "dreamone" + i, i);
//dream.x = Math.random() * 1600 - 800 + dreamoffset;
dream.x = dreamarrayX;
dream.y = 50;
dream.z = dreamarrayZ;
dream.onPress = released;
}
}
function inittwo() {
//set Number to more than number of dreams
for (var j:Number = 20; j<numClouds; j++) {
var cloud:MovieClip = attachMovie("cloud", "cloud" + j, j);
//tree.x = 400;
cloud.x = Math.random() * 2000 - 800;
cloud.y = 50;
cloud.z = 0 + cloudoffset;
cloudoffset += 600;
}
}
function released() {
for (var i=0;i<dreamarray.length;i++){
//var t:MovieClip = home["dreamarray"+i];
var t:MovieClip = dreamarray;
//These t. values are undefined when I click on one of the attached dreamarray MovieClips
t.xPos = dream._x;
t.yPos = dream._y;
t.theScale = dream._xscale;
if (dream != this._parent)
{
var tw:Tween = new Tween(t, "._x", Strong.easeOut, t._x, 300, 100, true);
}
trace(t);
trace(t.xPos);
trace(t.yPos);
}
}
function onEnterFrame():Void {
//if (dreamarray4.z >= 500 && Key.isDown(Key.UP)){
if (zdepth < 55 && Key.isDown(Key.UP)){
vz -= 1;
zdepth += 1;
}
//if(dreamarray4.z >=2000 && Key.isDown(Key.DOWN))
if(zdepth > 0 && Key.isDown(Key.DOWN))
{
vz += 1;
zdepth -= 1;
}
//Killed side to side motion
/*if(Key.isDown(Key.LEFT ) )
{
vx += 1;
}
if(Key.isDown(Key.RIGHT))
{
vx -= 1;
}
if(Key.isDown(Key.SPACE))
{
vy += 1;
}
*/
vy -= gravity;
vx *= friction;
vy *= friction;
vz *= friction;
for (var i:Number=0;i<dreamarray.length;i++) {
//i think there is a error here
var dream:MovieClip = this["dreamarray" +i];
dream.x += vx;
dream.y += vy;
dream.z += vz;
if(dream.y < 50)
{
dream.y = 50;
vy = 0;
}
/*if (dream.z <= -fl) {
//delete dream.z
dream.z_visible = false;
}
else if(dream.z > 3000 - fl)
{
dream.z._visible = true;
}
*/
if (dream.z <= -fl) {
//delete dream.z
dream.z._visible = false;
}
else
{
dream.z._visible = true;
var scale:Number = fl / (fl + dream.z);
dream._xscale = dream._yscale = scale*100;
dream._x = vpX + dream.x * scale/2;
dream._y = vpY + dream.y * scale/2;
//dream._x = dream.x * scale/2;
dream._alpha = scale * 60 + 40;
dream.swapDepths(-dream.z);
}
}
for (var j:Number=0;j<numClouds;j++) {
var cloud:MovieClip = this["cloud" + j];
cloud.x += vx;
cloud.y += vy;
cloud.z += vz;
if(cloud.y < 50)
{
cloud.y = 50;
vy = 0;
}
if (cloud.z <= -fl) {
cloud.z += 5000;
}
else if(cloud.z > 5000 - fl)
{
cloud.z -= 5000;
}
var scale:Number = fl / (fl + cloud.z);
cloud._xscale = cloud._yscale=scale*200;
cloud._x = vpX + cloud.x * scale;
cloud._y = vpY + cloud.y * scale;
cloud._alpha = scale * 60 + 40;
cloud.swapDepths(-cloud.z);
}
}
init();
inittwo();
stop();
String Attached To Mouse Effect
okay. I was just looking through some templates at template monster
when I cam accross this one:
http://www.templatemonster.com/flash...tes/10335.html
how on earth did they do that effect where the string is attached to the mouse?
Scrolling Text Effect - Link Attached
Does anyone know where I can find a tutorial for the scrolling text effect:
http://www.tinyeggs.com/wistaria/wistaria.swf
skip intro - it's located on the right hand side under "HOME". I've come across many similar scrolling text effects (manual) but I like this one better.
Thanks in advance
Menu Expand Effect Question (fla Attached)
Hey i was wondering if there was an easier way to do this its a bit messy as im new to flash and actionscript.
I would also like it to expand from only one side. e.g the left hand side of the box stays static whilst the other grows..
Thanks,
Josh.
Menu Expand Effect Question (fla Attached)
Hey i was wondering if there was an easier way to do this its a bit messy as im new to flash and actionscript.
I would also like it to expand from only one side. e.g the left hand side of the box stays static whilst the other grows..
Thanks,
Josh.
How To Restrict The Mask-Attached-To-Mouse Effect Happens In Frame #1 Only?
Please Help!
I want to ask if anyone know how can I control the Mask-Attached-To-Mouse Effect happens only at Frame #1? because even those it jumps to another scene, it still affects the new scene... all I want to do is, make the Mask-Attached-To-Mouse Effect happens in Frame #1 only, Please Help!!!!!!
Here is the swf movie:
http://www.kikilau.com/flash/bad_sample02.swf
Here is the fla file:
http://www.kikilau.com/flash/bad_sample02.fla.zip
here is the script then I've copied from a tutorial:
Stage.scaleMode = 'noScale';
this.createEmptyMovieClip("display_mc", this.getNextHighestDepth());
display_mc._x = reveal_mc._x;
display_mc._y = reveal_mc._y;
var maskbmp = new flash.display.BitmapData(mask_mc._width, mask_mc._height, true, 0);
var revealbmp = new flash.display.BitmapData(reveal_mc._width, reveal_mc._height, true, 0);
var displaybmp = revealbmp.clone();
maskbmp.draw(mask_mc);
revealbmp.draw(reveal_mc);
display_mc.attachBitmap(displaybmp, 1);
var displayRect = new flash.geom.Rectangle(0,0, mask_mc._width, mask_mc._height);
var offset = new flash.geom.Point(0, 0);
var basePoint = new flash.geom.Point(0,0);
display_mc.onMouseMove = function(){
offset.x = this._xmouse - displayRect.width/2;
offset.y = this._ymouse - displayRect.height/2;
displayRect.x = offset.x;
displayRect.y = offset.y;
displaybmp.fillRect(displaybmp.rectangle, 0);
displaybmp.copyPixels(revealbmp, displayRect, offset, maskbmp, basePoint, true);
}
Object Position Effect The Panning Of Attached Sound
hey guys from one of the tutorials found on action script or flaskit i have started to create and adapt my own thing...... for now i have used the sound files from the tutorial... but they will change once i have them......
right then....... urm!lol
i have made it so that the volume of the sound attached to each duplicate movie clip is contolled by its possition on -y. i have also tried to make each MC do the same but for the panning control, with its left right possition...... but somethings gone wrong......
i have tried to addapt several tutorials to try and complete this task......
each Mc has to be started from the current position other wise all the location points will be out, after working this problem out i want to experiment with putting behaviours on each block so that they can be thrwn accross the stage and bounce and colide with oneanother... with all this i think that the sounds produced could be cool and interesting, with a variation on user and computer control....... hmmmm what do you think????
ok just zipped my file and it was 26.1mb from 32.....so i shal type the code i have used.actually its not letting me attach anything....*cries
too confusing so i took some screen shots...... this will confuse everyone........
no worries if no one replies cos it weell past my bed time aand have not done this very welll
How To Create A Springly Effect On An Object Attached To A String
Yeah really in need of help. I've look into the tutorial on how to create a springly effect on an object but it applies only in Flash 5 and not in MX. The problem is i manage to get 1 object to have a springly effect but the other objects just cant seem to move due to the startDrag function or the OnClipEvent. help me....
Secondly , i have an object attach on a curve line and when this object is pull i want one end of the line to stretch and follow the object while the other point stays at its original position. This create an extended straight linehow?
How To Create A Springly Effect On An Object Attached To A String
Yeah really in need of help. I've look into the tutorial on how to create a springly effect on an object but it applies only in Flash 5 and not in MX. The problem is i manage to get 1 object to have a springly effect but the other objects just cant seem to move due to the startDrag function or the OnClipEvent. help me....
Secondly , i have an object attach on a curve line and when this object is pull i want one end of the line to stretch and follow the object while the other point stays at its original position. This create an extended straight linehow?
Fade In/out Effect On Dynamically Loaded Text Box With 'timer' Already Attached
First of all, please note that when I talk about a timer, I am referring to a OnEnterFrameEvent that dynamically loads new text in the text box every 350th frame.
Now, I want the text to load with a fade effect instead of the usual 'ba' effect which happens in one frame.
Currently, I have two text boxes located in a movieclip, both load dynamic text that was read into an array from an xml file at start up, the one loads the header of the message and the other loads the content.
I have put them both in a movieclip, 'latest_mc'. This is my code:
Code:
this.latest_mc.addEventListener(Event.ENTER_FRAME, loadNewLatest);
function loadNewLatest(e:Event):void {
if (loadedLatest) {
timer++;
// executes on 350th frame and then resets timer
if (timer == 350) {
timer = 0;
count++;
if (count < latestHeaderArray.length) {
loadLatest(count);
}
else if (count == latestHeaderArray.length) {
count = 0;
loadLatest(0);
}
else if (count < 0) {
count = 0;
}
}
}
}
function loadLatest(index:Number):void {
// gets index from function and loads relevant array item
this.latest_mc.gotoAndPlay("fadeOut");
this.latest_mc.latestHead_txt.text = latestHeaderArray[index];
this.latest_mc.latestCont_txt.text = latestContentArray[index];
this.latest_mc.gotoAndPlay("fadeIn");
}
Can anybody please help me with this? I know something has to happen in loadLatest(index:Number) to bypass the event handler, letting it perform over more than one frame.
Problem With Dynamic Links Attached To Dynamic MC's
My question is a little hard to explain (but I'll do my best) so I have added a link to my source files below for you to look at.
OK, I am working on the logic for a much larger project and I am about 95% of the way there. Basically what I am doing is loading a text file that contains variable information and then breaking that into arrays based on which category the user chooses. Once the user clicks on a category the array for that selection is broken apart and read. It then loads (dynamically) an image (whose name comes from my array) into the "holder" mc, sets it's link to an external HTML page, determines how many sub-buttons (based from the array) are needed and then populates them in their own emptyMovieclips inside another mc called "buttons" and gives each of them a unique link (also generated from the array) that changes the image in the holder "mc". This is where my problem is occurring, for some reason it is assigning the link of the last attached sub-button in the group to all of the other sub-buttons in the "buttons" mc. For the life of me I cannot figure out why, they should each have a unique link. Hopefully some fresh eyes can shed some light on this. Frame 5 is the gut of the code, any help would be greatly appreciated.
Thanks
Here are the source files:
http://www.icandraw.com/source.zip
Adding .fla Effect Over Map
Aloha everyone,
Am new to flash and seriously considering purchasing it using the demo right now. I was wondering if it possible to use a .swf file that I made in swish and place a .fla glitter effect over it while in flash. I can get the .fla effect to work over my map but then all the button (linking) effect that I made in swish dont work or areant clickable anymore once I place the .fla over it. Here is the map prior to placing the .fla effect over it http://tropicalrain.net/odins.swf Is it possible and if so can someone tell me how or where I can go to find out more on how to do this? Appreciate any info!
Many thanks,
TropicalPain
Dynamic Textfield Re-naming In Attached MCs
Hello,
this post may be a bit long winded.
Take a look at these first:
Admin section:
http://www.alienmade.com/psu/dev/_admin/vip_admin.html
Web section:
http://www.alienmade.com/psu/dev/nav.htm
First heres what I am doing now:
Each name and its corresponding title and email are pulled from a database and used to populate my "pre-defined" textfields. This system works well and there are no glitches. All the connecting lines that show the heirarchy have been hand done for each of the web section and admin interfaces..A real pain.
Heres what I want to do..I can get through most of what I need to do, but am having a few set backs in a few critical areas.
For the next version of this interface, I need to build in the ability of, on the fly creation of a new name area, complete with moveable textfiled MC and user defined connecting line to the heirarchy.
Heres the concept Ive been messing with:
Admin clicks a button and an MC opens (editMC) up with a few options:
Add a new name
|
check box(Show title/department with this name)
Makes choice and hits continue:
A "representation" of the new button shows within editMC, at this point the admin can move the button to the location they want.
Click continue again and the admin can add the starting and ending points of the line that will connect the name to the heirarchy.
(first click would be x,y axis, second click would be y axis only to keep the line from skewing).
At this point the admin can save the new name and all of the data for the name and line x,y coords are added to the database.
The editMC closes and the database is querried to pull out the new user and place it on the stage.
Soooo,
I need to know how to dynamicly change a textfield variable name within a dynamicly created or attached MovieClip.
How do you remove a line created with lineTo? Or can you?
Im still having problems with the line creation, but I should be able to accomplish that when the time comes.
There is alot of work to be done, and a lot of bugs to be worked out before I am convinced this will even function the way I want it to. Any help, ideas or input would be greatly appreciated..
Thanks again
3PRIMATES
Dynamic Text Attached To Scrollbar
hey,
i'm trying to load content using loadVariables into a dynamic textfield. Since you can't have dynamic text under a mask, i have to use the FScrollBar component. Now, it does not resize to the size my textfield gets when loading the vars.
I thought maybe it's because its attached to it before all the data is loaded into it, so i tried to detach it using setScrollContent(undefined), and the attaching it back to the textfield. But i can't get it to detach. It keeps controlling the textfield.
Can, anyone help me with that please ? Thanks
Attached Buttons With Dynamic Name+script
Hi everybody!
I'm working on a movie where I need a script to generate a URL menu, which should get the URLs as variables from a dynamically imported text file, and attach as many as buttons needed to the page_mc, and lable the buttons as URLs too.
I tried putting scripts on the buttons manually, or labling the button by something like a "button_1_lable" variable, but I need help for the script in the loop which generates a unique var name for each button's lable textfield, while attaching the buttons to the page...
I bet there are some easier ways to generate such a URL menu! do you know any?
cheers!
Manipulate Attached Dynamic Text
i have a small question..like this
i have attach one targetMClip :
this.attachMovie(target, "tmp_mc", 1);
in targetMclip got 10 text dynamic instanced:
texto1
texto2
texto3
texto4 and so on..
and in root timeline, i have button n scripted as:
function next() {
if (radioGroup.getValue() == myquiz.attributes.answer) {
_root.scroll1.tmp_mc.texto+"_root.sheet".text =myquiz. attributes. answer;
} else {
_root.scroll1.tmp_mc.texto+"_root.sheet".text = radioGroup.getValue();
}
}
_root.sheet++ ( sheet val will loop)
i want it loop and continue to texto2..3..4
when i press the button the scripts just cant run ... there any one can help me? is it posible? or i just wasting my time too.
thanks.
aly
Please Help, Dynamically Attached Dynamic Textbox
Hello,
I'm creating a timeline structured site where a movie clip on the stage called 'slider' is set to slide automatically according to how far left, or right the mouse position is from the center of the stage. This works. I even have it set it up so that using two variables, i can decide how much or even which portion of the movie clip (or the timeline) the user is allowed to slide around in.
I then have a movieclip called 'yearMarker' which is attached at runtime inside the 'slider' movie clip. This is done through a While loop and PHP script which retrieves from the database the field values for "year" (just a string denoting the particular year in question), and "yearXPosition" (which is how far along on the x axis the attached movie clip should be.
the string I retreive from php looks like this:
yearOf1=1976&yearPosition1=0&yearOf2=1977&yearPosi tion2=350&yearOf3=1978&yearPosition3=1350&yearOf4= 1979&yearPosition4=1700&yearOf5=1980&yearPosition5 =2050&...ect.
(I used the variable name 'yearOf' in place of year because flash already has a class property with that name.
I managed to attach the 'yearMarker' movie clip at the right x distance from the left border of the stage, and it works well.
My problem is whith a dynamic textbox within the 'yearMarker' movieclip. The intention is that when the movieclip is attached, the dynamic textbox within, 'yearMarkerText", is given the value of the Year in question, 'yearOf'.
Not only can I not get this part to work, It also seems that the textbox disapears altogether, though if I set the textbox to be selectable and then test the movie, the mouse cursor changes to select text where the textbox should be if it was visible.
The code, on the first frame on the root of the timeline, which attaches a movie clip based on the above values goes like this:
var yearMarkersVar = new LoadVars()
yearMarkersVar.load("
Dynamic Text In Attached Movie Not Working
I'm using a component "attach movie" to get a movie clip to scroll but the dynamic text layer in the attached movie is not showing up. The variable is passing to the movie clip but it's a no show in the text area.
I'm using _root.aa in the parent movie and the same in the attached movie. A trace in the attached movie displays the value in the output window.
Any ideas?
Dynamic Text In Attached Movie Clips
Hi
I am trying to construct a game which has 5 columns of 20 symbols each.
I am using Actionscript to attach these 100 symbols as Movieclips and then selecting a random frame within each movie clip to get a random symbol.
This first part all works fine.
The problem is that I also want to number these symbols from 0 - 99 and I have tried a similar approach using by attaching Movieclips which have a Dynamic Text field that I am then trying to update for each clip.
This part doesn't work - I have put a test value in the dynamic text movie clip and this displays so the clips are attaching and are being positined correctly. What is not happening is the updating of the value for each loop of i. The Movieclip that gets attached is called "number" and its Dynamic Text field is called "display".
Here is the code:
code:
initGame();
// stop ();
function initGame () {
// define right hand column & bottom row coords
firstcol = 470;
firstrow = 500;
// define deltas from start point
x = 0;
y = 0;
// loop 100 times to attach signs
for (i=0; i<100; i++) {
// attach movieclip for each sign
attachMovie("signs", "sign"+i, 100+i);
// move clip to correct coordinates
clip = _root["sign"+i];
clip._x = firstcol-x;
clip._y = firstrow-y;
// movie clip to random frame
clip.gotoAndStop(int(Math.Random()*12+1));
// THIS NEXT BIT DOESN'T WORK!!
// attach movieclip for each number
attachMovie("number", "num"+i, 300+i);
// set dynamic text field
display = i;
// move clip to correct coordinates
clip = _root["num"+i];
clip._x = firstcol-x-35;
clip._y = firstrow-y;
// increment deltas & start new column
// if necessary
y = y+25;
if (y>480) {
x = x+70;
y = 0;
}
}
}
Any help would be most gratefully appreciated!
Thanks,
Adam
Dynamic Field Center Problem (fla Attached)
hey guys, i have been trying to figure this for a looooong time. here is the what i have...
i want to be able to click a button and have a certain word(s) fill the dynamic text field. (i have been able to do this). but if the words go onto a second line i want them to be centered vertically. i thought all i would have to do is set the dynamic field to center the text. this isn't working though. in my example i am using th words "sneaky sneaky". since they are the same word when it is on 2 lines it should line up perfectly. however every time it drops down to the second line because of the space it is pushing the second line in so that they don't line up vertically. (makes more sense when you look at the fla.) any help would be appreciated. thanks!
http://babel.massart.edu/~jantonuccio/dynamicCenter.fla
[F8] Dynamic Text Field In Attached Movie
I am attaching a movie clip for each item in an xml file (the movieclip has a dynamic text field), but the text field will not display any text.
Here is the code for when users roll over the button:
mcLoadIcon.mcIconLoader[ic].onRollOver=function() {
iconName=ptRootNode.childNodes[i].childNode[lmt].attributes.Name;
this.txtIconName.text=iconName;
}
The xml loads correctly, iconName equals the correct text (I used trace to make sure), but the dynamic text box (this.txtIconName) will not display any text. I have embeded the text. Any hints?
Thanks.
Targeting An Attached Mc's Dynamic Text Field
I can not target the right path to the dynamically created text field inside a movie clip. That's either weird or I'm missing something.
I have a movie clip called (with the linkage) "mc" that has the following code in it:
ActionScript Code:
// I'm skipping the text format part
this.createTextField("infoArea1", 1, 0, 0, 600, 50);
this.createTextField("infoArea2", 2, 0, 28, 600, 100);
this.infoArea1.setNewTextFormat(bold);
this.infoArea2.setNewTextFormat(plain);
for (i=1; i<=2; i++) {
this["infoArea"+i].html = true;
this["infoArea"+i].multiline = true;
this["infoArea"+i].wordWrap = true;
this["infoArea"+i].selectable = true;
this["infoArea"+i].border = true; // to see if the fields are there
}
and in the main scene I'm using:
ActionScript Code:
this.attachMovie("mc", "emptyMC1", 1);
this.attachMovie("mc", "emptyMC2", 2);
this.attachMovie("mc", "emptyMC3", 3);
this.emptyMC1._y = 150;
this.emptyMC2._y = 300;
this.emptyMC2._y = 450;
// no problem with the code above
// but below code does not work?
this.emptyMC1.infoArea1.text = "aaaaaaa";
What is it that I'm missing?
Dynamic Mc With OnRelease = Function Attached Not Working ?
Hi
Something is definitely wrong with my code here since i can`t get the created movie clips to have a function attached to them
Here is my code
-flash
import flash.display.BitmapData;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
image_height = [];
image_width = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
image_width = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
image_height = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
_parent.container_mc.createEmptyMovieClip("mc_" + i, this.getNextHighestDepth());
_parent.container_mc["mc_" + i]._x = 30 * i;
_parent.container_mc["mc_" + i]._y = (_parent.container_mc._height - image_height ) / 2;
var target_mc:MovieClip;
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
var bitmap:BitmapData = new BitmapData(target_mc._width, target_mc._height, true);
target_mc.attachBitmap(bitmap, target_mc.getNextHighestDepth(), "never", true);
target_mc.clear();
bitmap.draw(target_mc);
target_mc._height = 250;
target_mc._width *= target_mc._yscale/100;
};
this["image_" + i + "_mcl"] = new MovieClipLoader();
this["image_" + i + "_mcl"].addListener(mclListener);
this["image_" + i + "_mcl"].loadClip(image, _parent.container_mc["mc_" + i]);
this.container_mc["mc_" + i].onRelease = function()
{
getURL("
Dynamic Attached Button_mc + Targetting Proper Value
Hi once more
so i've managed to get flash building up a menu that reads from a xml file
it nicely attaches buttons for the amount of nodes i want to be shown
(11 in this case) it will change over time, and i don't feel like recoding every button behavior everytime the menu needs to get updated, cheers for dynamic...
all the names are filled in nicely, but 1 thing is missing and i can't find out where my mistake could be.
i've spent over 3 days now, fiddling around with the code, yet nothing works, or works half...
here is the deal:
ps the theName_str is is "masked" for obvious reasons
Code:
var i:Number;
var theName_str:String = "/place/to/look/for";
var name_array:Array = XPathAPI.selectNodeList(this.firstChild, theName_str);
for (i=0; i<name_array.length; i++) {
var SB = attachMovie("sub", "buttonsub"+i, i);
SB.btntxt.text = name_array[i].firstChild.nodeValue;
trace(" "+i+"."+name_array[i].firstChild.nodeValue);
SB.onRelease = function() {
trace(" "+i+"."+name_array[i].firstChild.nodeValue);
}
}
so this in the output gives me nicely all the values i want in the button textfields.
yet if i press a button , the output gives me something like
Code:
SB.11 undefined
11 stands for the amount of nodes that is being loaded.
when i change the code to
Code:
SB.onRelease = function() {
trace(SB + "."+name_array[i].firstChild.nodeValue);
this traces in the output... it's very confusing for me at this point
Code:
_level0.SB10.undefined
so i'd like to know how i could trace for example when i press the third button, it says SB.03 name of the corresponding node
so in other words SB.03 in the textfield says kirupa
how do i trace when i click on it "sb.03 kirupa"
i hope this is well written for someone to understand, my english isn't that well. is there anyone here that wishes to guide me? much appreciated
kind regards
triss
Trouble Writing Dynamic Function, With Attached MCs
Okay, I've been smashing my skull on this for about a week now.
The goal: when the user clicks on the button, a movie clip appears. The user can click and drag this movie clip around the stage. Click on another button, a new movie clip instance appears, and can be dragged around, etc., ad nauseum.
If I hard-code the script on each button, the script works fine:
ActionScript Code:
var i=1;btn1.onRelease=function(){ //increment i i++; //create an emptymovieclip _root.createEmptyMovieClip("hold1", i); with(hold1){ _x=btn1._x; _y=btn1._y; } //attach movie clip from library hold1.attachMovie("infobar", "iBar", i) trace(hold1.iBar); //add text hold1.iBar.tField.text="Number "+i; //click and drag hold1.iBar.onPress=function(){ hold1.iBar.startDrag(); } hold1.iBar.onRelease=stopDrag;}
All well and good, except I'll eventually have fifty-odd buttons. Ecch. But when I try to build a reuseable function from that code, all that happens is that my button instances shift around the stage:
ActionScript Code:
var i=1;function grabIt(button, words, holder) { //button.enabled = false; goAway(); //increment i i++; //create emptymovieclip _root.createEmptyMovieClip(holder, i); trace(holder); with (holder) { _x = button._x; _y = button._y; } //attach movie clip from library holder.attachMovie("infobar", "iBar", i); holder.iBar.tField.text = words; //drag functions holder.iBar.onPress = function() { holder.iBar.startDrag(); }; holder.iBar.onRelease = stopDrag;}//btn1.onRelease = function() { grabIt(btn1, "T'John", "a");};
The movie clip never is attached, and all the buttons shift position. I know there's probably a better/easier way to do this, but right now I can't see it. Any help is appreciated!!
Adding Music/fade In/out Effect
i can't figure out how to put music and a fade in/out effect on it for my flash movie that i just made... someone help me please..
also.. i'd like to kno how to make my last frame which says with a giant ENTER on it to be a link to my webpage.. thanks
Adding Transition Effect To Every Letters
is there a way to add transitions effect to every letters in a string in actionscript 2? i know how to split the string into and places it into array but how do i apply transitions effect to it?
Adding Sound Effect To Link
I have a "Main" gallery page which has a selection of photos of different subjects...Antarctica, Autumn, Alaska, etc... When you click on one of the images it takes you to another gallery of just those images. This page is set up as html, not Flash. Perhaps I should/might change that, with a lot of help from everyone out there.
I want to add a camera shutter sound to the Main gallery photos so that when you click on the photo or text link you hear the "camera shutter" sound and are taken to the next gallery. I have the .wav file, just not sure how to or if I can do this. Here is the Main gallery page, http://www.westlight.net/main_gallery.html.
I'm using DW 8 and do have (Flash as well, but limited knowledge of it.) Any suggestions on how to rework this page would be appreciated.
Adding A Menu Under A Curl Effect...
Hey Everyone.
Im needing some help on how i can add a menu navigation under my page curl button effect. So when the user rolls over the corner the page curls up and out comes the menu, where you can click on and so on.
I can only get to the stage where i have the menu in place and it comes up under the curl, but when i want to click onto the menu links i cant, because of the curl effect button. Its like a button on top of a button, they just clash into each other.
Is there any way i can work around this.
Any help would be amazing..please please...
Many thanks
kym
Adding Cursor To Typewriter Effect?
Is it possible to ad a cursor using this typewriter effect
ActionScript Code:
myText = new LoadVars ()myText.load ("test.txt")myText.onLoad = function () { _root.holder = this.test _root.index = 1}_root.onEnterFrame = function () { if (_root.outputbox.length != 100) { _root.typer = _root.holder.charAt (_root.index) _root.outputbox.text += _root.typer _root.index ++ }}
would i have to like use the setProperty to find the _x and_y of the current letter being typed and add the cursor moveclip after it??
I am trying to use a blinking Rectangle cursor like the DOS curor..
Thanks in advance
Adding A Flash Effect To This Link Nav
We want to add like a effect to the flash nav http://matternwebdesign.com/flashbang with a light shining from the back of the text through it kinda like a spotlight from the rear shining through the text back and forth.
Or just in general some type of effect for that link nav, right now everythings form scratch , just want an effect to the link nav, preferably pretty nice effect.
To build it we used the tutorials bought form http://cartoonsmart.com the "webdesign" flash tut and the "nimation" flash tut. Just stuck on this one thing pretty much so far.
I want the typeof effect like on http://www.alpha.inf.br/samsung/ in the begining where it says samsung and the test shimmers light across it , thats basically what i want , is that action-script ?
and it would be cool to add a mp3/.wav player to it like yours mikey , if you have a tut for that also.
Thanks to whomever responds.
Regards,
Travis Mattern
Adding Transition Effect To A DuplicateMovieClip From An Arr
Hello,
I want to make a script that takes some pic from my library, and animate them (using transition effect that comes with flash). The main idea it's that random a pictures it's picked and the transition(OUT) start's,simultanios another pic it's duplicated and take's the _x and _y of the first picture and start the transition(IN)
Here it's the script that i came...but i don't know ( i can't find the bug) where the problem it is:
Code:
import mx.transitions. *;
//
this.createEmptyMovieClip ("img1", 21);
this.createEmptyMovieClip ("img2", 22);
this.createEmptyMovieClip ("img3", 23);
this.createEmptyMovieClip ("img4", 24);
//
img1.attachMovie ("pic1", "pic11", 10,
{
_x : 24, _y : 5
});
img2.attachMovie ("pic2", "pic22", 12,
{
_x : 24, _y : 99
});
img3.attachMovie ("pic3", "pic33", 13,
{
_x : 24, _y : 195
});
img4.attachMovie ("pic4", "pic44", 14,
{
_x : 24, _y : 290
});
//
var y : Number = 0;
var dMc : MovieClip;
var picArray : Array = new Array (img1, img2, img3, img4);
for (var i : Number = 0; i < picArray.length; i ++)
{
var randNr : Number = Math.round (Math.random () * picArray.length)
var randArray = picArray [randNr]
new Tween (randArray, "_alpha", Strong.easeNone, 100, 20, 2, true)
TransitionManager.start (randArray,
{
type : Iris , direction : Transition.OUT, duration : 4, easing : Bounce.easeOut, startPoint : 5 , shape : Iris.SQUARE
});
var y : Number = Math.floor (picArray.length - randNr)
dMc = picArray [y].duplicateMovieClip ("poza" + y, _root.getNextHighestDepth,
{
_x : randArray, _y : randArray
})
TransitionManager.start (dMc,
{
type : Iris , direction : Transition.IN, duration : 4, easing : Bounce.easeIn, startPoint : 5 , shape : Iris.SQUARE
});
}
Thank you in advance, btibia!
Adding A Menu Under A Page Curl Effect
Hey Everyone.
Im needing some help on how i can add a menu navigation under my page curl button effect. So when the user rolls over the corner the page curls up and out comes the menu, where you can click on.
I can only get to the stage where i have the menu in place and it pops up, but when i want to click onto the menu links i cant, because of the curl effect button. Its like a button on top of a button.
Any way i can work around this.
Any help would be amazing..please please...
Many thanks
kym
DYNAMIC Text Fields Randomly Attached And Attacking By Typing
HI,
I have dynamic text boxes in a typing game that when a random number is produced it attaches the text filed, applys arandom letter or word, and it falls down the stage along with a creature graphic.
The idea is you have to type the letter or word attached to the MC to kill it and then just send the MC to a different frame.
We have the attaching and falling done but cant work out how to get it to die when you type the letter or word.
I have tried things like
-------
KeyListener = new Object();
KeyListener.onKeyDown = function() {
for (i=0, i<newbaddie.length, I++){
if (newbaddie.charAt(i) == (String.fromCharCode(Key.getAscii())) {
die = true;
}
}
-----------
But NO JOY ?
we then have the problem of How do I set the focus of which MC we are trying to kill ?
If you start typing one ,..I want the viewer to HAVE to finish that one.. before he can kill any others !
so I guess I dont know how to set the focus of the Dynamic text field?
I have the MC's falling at differnt random speeds aswell
Any ideas
Thanks in advance
Dynamic ComboBox Is Giving Negative Depth To Attached MovieClip?
Hi guys, I've got this new problem where I'm trying to remove a container movieclip i've attached the first time the function is run, but I try to remove it and replace it again, but the second time around it gets a negative depth and all goes to hell. any ideas??
Code:
function populateBasket(){
trace("B4 REMOVE:" + basketRows.loader.container.getDepth());
basketRows.loader.container.removeMovieClip();
trace("AFTER REMOVE:" + basketRows.loader.container.getDepth());
basketRows.loader.attachMovie("~container","container", 0);
trace("AFTER ATTACH:" + basketRows.loader.container.getDepth());
for(i=0;i<items.length;i++){
var myMC = basketRows.loader.container.attachMovie("~basket_row","row" + i, i);
myDropDown = myMC.cbcontainer.attachMovie("ComboBox","qtyCB", 0);
myDropDown.setSize(43,22);
myDropDown.addItem({label: "1", data: 1});
}
};
populateBasket();
mybtn.onPress = function(){
populateBasket();
};
output when swf loads:
B4 REMOVE:undefined
AFTER REMOVE:undefined
AFTER ATTACH:0
output when I press the button:
B4 REMOVE:0
AFTER REMOVE:-32769
AFTER ATTACH:-32769
Applying Dynamic Functions To A Button Nested In An 'attached' Movie
I can't get this to work.
I'm attaching several movie clips from my library. Within each clip is a button. I need to assign a function to each button when the clip is attached - but the functions will be slightly different for each button. E.g. I want flag1.flag_button to display the flag1.title_text on rollover.
Code:
_root.tiles.attachMovie("flag_pin", ("flag" + k), (_root.depth));
eval("_root.tiles.flag" + k)._x = x;
eval("_root.tiles.flag" + k)._y = y;
eval("_root.tiles.flag" + k).title_text.text = eval("_root.sites.site" + k + "_title");
eval("_root.tiles.flag" + k).flag_button.onRollOver = function () {
title_text._visible = true;
}
eval("_root.tiles.flag" + k).flag_button.onRollOut = function () {
title_text._visible = false;
}
Thanks,
[f8] Adding Very Simple Text Effect To Mouse Trailer..?
Hello, I'm new here.. great site!
I'm also new to Flash, and I'm trying to figure out how to do a very simple text mouse trailer. I checked out the tutorials on the site, but they all seem to do more than what I'm looking for (I don't want any crazy effects or anything).
Basically what I am looking to do is exactly like the map at Lonely Planet here .
Simply, when you mouse over a particular region, the region changes color and text appears next to the mouse pointer with the name of that region. Right now I have these regions set up as buttons, because it seemed a little simpler than movie clips, but if I need to make them movie clips, I am willing to do that.
Thanks for any input you have!
Adding Transition Effect To Image Dynamically Imported
Okay.
I've made a simple picture slideshow. With 10 frames and on each frame a movieclip. On every frame, I use the 'loadMovie' method to import a file..
A set of buttons are used to surf through the frames..
Okay, I wanted to know, is there any other possible way to add a fade-in fade-out transition while changing the pic from frame 1 to frame 2.. ?
The way i know of doing it will be like this;
Making a movieclip, MC1, and in there, another movieclip, imagehandler MC, where that image is brought using 'loadMovie' method. And fading in imagehandler MC from frame 0 to frame 10 using motion tweening like we normally do..
And putting that MC1 (with MC2 fade in effect inside)to each of the 10 frames in the main slideshow timeline (making different MC1 like MCs for each image)..
But this way its much more work and more cramping in the library..
Is there any other suitable way of doing so ?
Action Works Attached To A Button But Not When Attached To A Frame
can anyone tell me why the following button script works:
on (release) {
_root.welder.eyes.gotoAndPlay(2);
_root.welder.gotoAndPlay(2);
}
but this virtually identical script won't work in a frame (on the same timeline as the button):
_root.welder.eyes.gotoAndPlay(2);
_root.welder.gotoAndPlay(2);
i've been pulling my hair out all day over this. i can't think of an explanation as to why the second example wouldn't work. its baffling to me.
Simple: Dynamic And Input Text Boxes Wont Show When They're In An Attached MovieClip
Hey.
I am re-attaching the same movie clip (containing dyanmic text boxes) over and over again, filling a menu... and i have therefore used a mask so that a scroller must be used to view the elements of the menu far down on the list. Unfortunately, using a mask means that the dynamic text boxes within each movie clip become invisible for some strange reason (though they still exist, and i can select the text that they contain). Taking the movie clips outside of the mask allows the text to show, however, the long menu 'spills' onto the rest of the presentation.
How can i get dynamic text boxes to show within my mask?!
Thank you very much
|