Tweens On Clips And Unique Instances
I have a little bit of code that sits in a movie clip, and triggers a couple of tweens. The first tween affects _parent, and onMotionFinished then triggers another tween in the clip itself.
The clip is attached to another clip onRollOver, and removed onRollOut. It is meant to be used as a button-type effect:
Code: var myTarget = this; var fadeThrobIn:Object = new Tween(this._parent, "_alpha", Bounce.easeOut, 20, 100, 2, true); var trans:Transform = new Transform(myTarget);
fadeThrobIn.onMotionFinished = function():Void { //trace("hi there"); var throb:Object = new Tween(myTarget, "_alpha", Strong.easeOut, 100, 20, .75, true); throb.onMotionChanged = function():Void { var am = myTarget._alpha/100; var mu = myTarget._alpha/100; var um = 100/myTarget._alpha; var co = myTarget._alpha*2.55; // channel offset var colorTX:ColorTransform = new ColorTransform(1, 1, 1, am, co, co, co, 0); trans.colorTransform = colorTX; }; }; The problem is this; when a button is rolled over, the clip is attached and the code triggers just fine. However, If another button is rolled over before the first animation is done, the internal tween picks up both onMotionFinished events, so triggers twice. Here's the code that calls the clip:
Code: fadeIn = function(myTarget, ani01):Void { var ani01:String; target.attachMovie(ani01, "throbber", myTarget.getNextHighestDepth(), {_x:5, _y:5}); target.onRollOut = function(){ removeMovieClip(myTarget.throbber); } }
btn_test01.onRollOver = function():Void { // trace("handler called"); fadeIn(this, "throbber_01"); } (note that all import stuff is taken care of, so the effect does work)
How do I build a handler that will allow each instance to be unique, without explicitly naming each one? Or is there a better way to avoid this conflict?
I can attach the FLA if anyone is interested.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 07-08-2007, 10:18 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Unique Multiple Instances From One MC
I hope someone out there can help me out with this problem, because it is currently beyond my newbie capabilities. I have a title identifer movie clip I created to identify 10 thumbnails upon mouse rollovers. When you rollover thumbnail "1" the following text appears below it: "Title: Photo 1".
My problem occurs when I try to setup thumbnail "2" using an instance of this title identifier MC. When I change the text inside this second instance to show "Title: Photo 2" what ends up happening is that the first instance that originally showed "Title: Photo 1" also changes to show "Title: Photo 2".
Is there anyway to create 10 instances of one MC and yet still have the ability to alter the text within each individual instance so each one can be unique?
I guess this can be done using some sort of Actionscript but I'm still too new to know how to make this happen. There has got to be an easy way to make this happen.
Something I tried was making 10 duplicates of the instance and renaming each one individually. This did not work. I also tried assinging instance names inside of the instance dialog box and this did not help. If someone can provide me with some help I would greatly appreciate it.
Making Instances Unique
Hey there,
I have a movieclip that has many layers and I would like
to copy this clip and change one part of the new symbol without changing the original clip. Is there any way I can do this without breaking my entire duplicate clip apart? In 3d I am used to making a duplicate reference unique by the click of a button, does flash have a similar function? Thanks for all your help, it will save me a lot of work.
Thanks!
Bas
Unique Variables In Duplicated Clips
Code:
onClipEvent(load)
{
this._x=_root.fish._x;
this._y=_root.fish._y;
speed=13;
if(_root.fish._x>_root.fish2._x)
{
_xscale=-(_xscale);
this.missileright=0;
}
else(_root.fish._x<_root.fish2._x)
{
this.missileright=1;
}
}
onClipEvent(enterFrame)
{
if(this._x>_root.fish2._x)
{
if(this.missileright==0)
{
this.missileright=0;
}
else if(this.missileright!=0)
{
_xscale=-(_xscale);
missileright=0;
}
this._x-=speed;
}
else if(this._x<_root.fish2._x)
{
if(this.missileright==0)
{
this.missileright=1;
_xscale=-(_xscale);
}
this._x+=speed;
}
if(this._x>505)
{
this._x=0;
}
else if(this._x<-5)
{
this._x=500;
}
if(this._y>_root.fish2._y)
{
this._y-=10;
}
else if(this._y<_root.fish2._y)
{
this._y+=10;
}
if(this.hitTest(_root["fish2"]))
{
this.removeMovieClip();
}
}
Also when you hit insert and shoot the fish missle sometimes it comes out the right direction and sometimes it doesn't(this only happens if the red fish is moving, the controls for the red fish are A and D), it should not vary, I can't figure it out. Its going by the missileright property of the parent clip and not the property of each child clip, how do I change this? Here's the URL:
fish
Multiple Unique Random Movie Clips
Hi,
I need to put 6 random movie clips on a stage (out of about 80 clips) and they can't ever be the same. I will also need to resize 5 of the movie clips depending on the location on the page. This is for an eye chart. The movie clips are possible lines of the eye chart and I want to randomly bring in and scale them as they go down the page. Has anyone reading this done something similar with random unique movie clips??
Thanks in advance for any help anyone can provide.
My apologies if this "random question" is a very worn out.
BEATDUKE!!
Wont Recognize The Unique Name Im Giving The Clips
ActionScript Code:
assetPath = "";
cars_xml = new XML();
cars_xml.onLoad = carList;
cars_xml.load(assetPath+"cars.xml");
cars_xml.ignoreWhite = true;
var loadListener:Object = new Object();
loadListener.onLoadStart = function(target_mc:MovieClip) {
};
//if xml load worked, populate the car images
function carList(success) {
imagePath = 'http://www.chevroncars.com/store/catalog/images/';
if (success == true) {
xval = 25;
newSetx = 0;
imageNameNumber = 0;
setNameNumber = 1;
var setIDname = "set05attach"+setNameNumber;
for (var n = 0; n<cars_xml.firstChild.childNodes.length; n++) {
var imageName:String = "container"+imageNameNumber;
_root[imageName].bubName = cars_xml.firstChild.childNodes[n].attributes.carname;
//if there is more than six cars in a set, create a new set
if (imageNameNumber>=6) {
xval = 25;
newSetx += 600;
var imageName:String = "container"+imageNameNumber;
setNameNumber += 1;
var setIDname = "set05attach"+setNameNumber;
_root.draggables.set05.attachMovie("set05attach", setIDname, _root.draggables.set05.getNextHighestDepth(), {_x:newSetx, _y:0});
}
//assign each new clip with this x and y values
var container:MovieClip = _root.draggables.set05[setIDname].loader.createEmptyMovieClip(imageName, _root.draggables.set05[setIDname].loader.getNextHighestDepth());
_root.draggables.set05[setIDname].loader[imageName].bubname = cars_xml.firstChild.childNodes[n].attributes.carname;
_root.draggables.set05[setIDname].loader[imageName]._x = xval;
_root.draggables.set05[setIDname].loader[imageName]._y = -7;
//HERE IS WHERE THE PROBLEM STARTS:
//I ASSIGN A VARIABLE CALLED BUBNAME TO EACH CLIP THAT SHOULD BE UNIQUE TO THAT CLIP
_root.draggables.set05[setIDname].loader[imageName].bubname = cars_xml.firstChild.childNodes[n].attributes.carname;
loadListener.onLoadInit = function(target:MovieClip) {
target.onRollOver = function() {
_root.bubble._x = _xmouse-_root.bubble._width/2;
_root.bubble._y = _ymouse-_root.bubble._height;
_root.bubble.startDrag();
//RIGHT HERE, I TELL A DYNAMIC TEXT BOX TO SHOW THAT VARIABLE
//IT DISPLAYS 'UNDEFINED' :( it should display that cars name...
_root.bubble.bubbleName = this.bubname;
};
target.onPress = function() {
if (target._alpha == 50) {
target._alpha = 100;
} else {
target._alpha = 50;
}
};
target.onRollOut = function() {
bubble._x += 5000;
bubble.stopDrag();
};
};
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
mcLoader.loadClip(imagePath+cars_xml.firstChild.childNodes[n].attributes.imageURLtag, _root.draggables.set05[setIDname].loader[imageName]);
xval += 92;
imageNameNumber += 1;
loadListener.onLoadStart = function(target_mc:MovieClip) {
};
}
}
}
Dynamically Give All Movie Clips Unique Instance Names?
is their a way to dynamically give all movie clips unique instance names?
Example:
I have 20 different MCs without instance names and when it loads or exports (doesn't matter to me) it will give instance names like p1, p2, p3, p4, etc... to all the MCS
Possible?
Controlling Instances In Movie Clips From Other Clips
I am trying to get a button on my level 2 in my main movie to point to a frame inside a movie that has been loaded in on level 3 on the main movie. I have tried all different kinds of combinations and no success. I even tried putting the level 3 movie in an empty movie clip on the root, and naming the instance "music", and then writing in the button _root.music.GotoAndPlay(3); I need it to target frame 3 in my level 3 movie. Should I put the level 3 movie in its own empty movie clip? I was able to get the button to unload movie3, but I don't want it to dissapear, I just want it to go to frame 3 in the movie clip to turn off the music.. You can see what I mean at the address below. I have my audio player in the bottom right with an on/off that works fine, but when I go to the link in my site "Music" there are some downloadble MP3's, and when you click on one I want the "equalizer bars" you see in the audio in the lower right corner to stop, and it means I need it to go to frame "3" of tha movie clip for that to happen, just like it does when you click on "off" in the audio movie. Anyway, sorry this is long winded, but wanted to make sure it was clear as to what I am trying to do..
Thanks in advance,... Here is the link
http://www.incogneato.tv/stales
Mike
Movie Clips & Tweens
I have two problems.
1) First I have a bunch of movie clips
inside my main flash movie and in each clip I just want the scene
to play once and stop - so I have an action at the end to stop.
Then when it's all done I want the actual main movie to loop again,
but it won't and I have an action in the main movie to go to &
play scene 1. But it does nothing. Can you Help?
2) My tweens are moving very slow. I have done everyhting I
can to make them move faster and I see some flash movies
there the tweens are like lightening speed. Can you tell me how to make a tween move as fast as possible?
Motion Tweens/movie Clips
Hey all, basically i have a central box which is the main part of the site and a menu down the left hand side. When a link is clicked a rectangle extends across the length of the main box and displays the content of the link. Now when i click on another link I want the rectange which was shown before (with the content) to minimise back in and the new rectangle (obviously with different content) to extend out and take its place.
I can make the tweens so the rectangle extends out and shows the content but the rest is beyond me. Any ideas of how i can achieve this or any other possible ways to show each link.
Many thanks
Lopster10
Motion Tweens And Movie Clips
A couple of basic questions.
1. What is a 'movie' symbol? whats the difference between this and a graphic.
2. Say i had a car moving across the screen with a motion guide, and i wanted some oval wheels to follow the car - so they stay in the same place in comparison with the car (and a CW motion tween so they turn) how would i go about this?
thanx,
slug
Dynamic Clips, Loops & Crazy Tweens
I'm experimenting with attaching clips dynamically(vertically) and then, when you click on one of them, it expands vertically and the clips above and below it tween accordingly. (to gracefully make room for the expanding clip)
my initial idea was to build 2 arrays for each dynamic clip one array to hold the dynamic names of every dynamic clip above the selected clip and another array for every clip below it.
Then, when the user clicks on one, i would use a loop to use the tween class to move all the clips above our clip up simultaneously and all the clips below down... you get the point.
the roadblock i'm running into is the for loop constructor. Can you use any number other than 0 (zero) in this? :
Code:
fo(i=0; i<someVar; i++);
???
If I can figure out some way to do this, then i can determine the index position of my clip. Then, if my clip has an index of 10 out of 20 clips, i can build an array out of clips with index 11-20.
check out my code where i attempt to do this. it seems that the for loop contstructor only accepts "0" when you initialize it. grrr!!!! any other way to do this?
Code:
stop();
//load Tween class
import mx.transitions.Tween;
import mx.transitions.easing.*;
mXML=new XML();
mXML.ignoreWhite=true;
mXML.onLoad=function(success){
if(success){
itemz=this.firstChild.childNodes;
for(i=0; i<itemz.length; i++){
item=holder.attachMovie("dynClip", "dynClip"+i, i);
item._y=i*32;
item.yPos=item._y;
item.index=i;
item.dText=itemz[i].attributes.text;
//build arrays for clips above and clips below
item.above=new Array();
item.below=new Array();
for(j=0; j<item.index; j++){
item.above.push("dynClip"+j);
}
item.aboveVar=item.index+1;
for(k=item.aboveVar; k<itemz.length; k++){
item.below.push("dynClip"+k);
}
item.hitButton.onRollOver=function(){
gotoAndPlay("over");
}
item.hitButton.onRelease=function(){
trace("index: "+item.index);
trace("aboveVAr: "+item.aboveVar);
trace("above: "+item.above);
trace("below: "+item.below);
}
}
}
}
mXML.load("vsk.xml");
the problem is in this block of code:
Code:
item.aboveVar=item.index+1;
for(k=item.aboveVar; k<itemz.length; k++){
item.below.push("dynClip"+k);
}
any guidance is greatly appreciated!
Drop Shadows, Shape Tweens, & Movie Clips OH MY
I am trying to animate a bouncing ball (I have successfully done this); and trying to add a realistic drop shadow (on the "ground") so that the shadow is soft and blurry when the ball is at the highest point and strongest when it meets with the ball on the ground. I'm new to Flash and am not sure the best way to go about doing this. Any help is greatly appreciated!! -mbp-
Movie Clips And Instances
Say I have a movie clip called Banana. How can I place an intance of Banana called Banana1 onto the stage using actionscript.
Dynamically Creating Instances Of Movie Clips
I'm wondering if it's possible with actionscript and Flash MX2004 Professional to create instances of a movie clip at run time. For example, say I wanted to make a program that had a text box into which a user could type a number. Based on that number the program would display that number of instances of the movie clip. Further, I would like to be able to set the properties of those instances at runtime in actionscript.
Let me know if I'm unclear.
Thanks,
Legion
Changing Text In Movie Clips/instances
I created a movie that has text. I see that if I create different instances of this movie and change an instance or change it from the library it changes all of them. At least that's what's happening and that makes sense.
I want to duplicate the movie but have different text. I duplicated it in the library and created an instance of the duplicate version.
If I change the text in the duplicate or in an instance of it, it changes the original in the library and all instances of it -- all instances both original and duplicate. All I want to do is end up with 2 movies that are essentially the same except one line of text is different. I obviously don't want to recreate it each time I need it and I'm going to need several versions of it.
It's obvious that I'm new, so thanks.
Changing Text In Movie Clips/instances
I created a movie that has text. I see that if I create different instances of this movie and change an instance or change it from the library it changes all of them. At least that's what's happening and that makes sense.
I want to duplicate the movie but have different text. I duplicated it in the library and created an instance of the duplicate version.
If I change the text in the duplicate or in an instance of it, it changes the original in the library and all instances of it -- all instances both original and duplicate. All I want to do is end up with 2 movies that are essentially the same except one line of text is different. I obviously don't want to recreate it each time I need it and I'm going to need several versions of it.
Variables And Instances And Movei Clips Rotting My Brain
Bit of a tricky one, this.
I have loads of movie clips - over 100. Well, it is one, copied and pasted 100 times, to keep file size down. Each one has a different instance name (1, 2, 3, 4 etc) and in the main timeline there are over 100 text boxes with corresponsing names (1, 2, 3, 4 etc).
In these movie clips, depending on what frame each one is at, it puts a different variable into its corresponding text box, e.g. "house", "factory", "shop" etc. There are about 20-25 of these variables.
The actionscript which does this is:
Code:
Set Variable: "_level0:"&_name = /:status
Which basically says, find the text box in the main timeline with the same name as the hosts movie clip instance name, and enter the contents of the text box "status" (which is in the main timeline).
Ok, that's the background sorted.
This method works. Hurrah. But I now need it to work kind of in reverse. With me? Ok, stay with me on this one...!
I have a movie, very similar to the above one, but instead of creating the variables (which are then passed to a database using ASP), variables are entered INTO it using the ASP and database. I can do that, but the Flash is not liking it. Well, it is, but it's not doing what it should!
These 100 or so text boxes in the main timeline become populated by data passed into them from the database. I want the data in these (e.g. "house" "shop" etc) to make the movie clip with the same name go to the frame with the same name as that data.
For example, say for movie clip number 35. Data is passed into the text box called "35". Let's say this data was the word "house". In movie clip 35 there would be some actionscipt, not dissimilar to the above, which reads the data from this text box, and goes the frame. So, it would see that the word "house" was there, and so would go to and stop the frame named "house" within that movie clip.
I have tried putting this in the Movie Clip:
Code:
Go to and Stop ("_level0:"&_name)
But it doesn't seem to work. Any ideas??
I'm passing data into the movie by attaching it to the URL of the movie. So, for the above example, the HTML page would embed the movie with the URL
movie.swf?35=house etc
Get me drift? Good!
I know it's a long explanation but it's a bit of a tricky one to sort out. Pleeeease, any help! I'm pretty much desparate now - this is basically my last hope.
Thanks,
Nick
Changing Instances Of Movie Clips Within A Scrolling Background
Hey guys,
this prob sounds quite easily to resolve but I couldnt find a solution yet.What I want to do is to give the illusion to move a movie clip, a person, with the aid of a scrolling background. when the person arrives in front of another movie clip (part of the scrolling background) and the player presses a key, I want this movie clip to change the appearance.
I tried different possibilities like
Code:
onClipEvent (enterFrame) {
if (scrollingbackground._x=positionoftheperson) {
if (Key.isDown(Key.UP)) {
_root.scrollingbackground.movieclip1.gotoAndStop(2);
}
} else {
_root.scrollingbackground.movieclip1.gotoAndPlay(1);
}
}
but nothing worked
could anybody please help me?? thanks a lot!!!!
Putain
Assigning Loader Instances To Multiple Container Clips
I have a project where I am loading in a variable quantity of photos and then assigning them to a finite amount of containers.
I have 18 containers, and I can have between 1 and 18 photos. So if I have 1 photo it should be placed in all 18 containers, if I have 2 they should each go in 9 containers.
Right now I am loading in the photos successfully but I am having issues making them children of the multiple containers.
Here's the relevant code
Code:
private function RenderPhotos():void
{
Globals.Debugger.text = "";
this.mcContainer.gotoAndStop(1);
var singleTimer:uint = 10; //Number of seconds for one photo animation.
var numPhotos:uint = URLList.length; //Number of photos
var numPlaces:uint = this.mcContainer.numChildren; //Number of slots for photos
var count:uint = 0;
for(var i:uint = 0; i < numPlaces; i++)
{
if(count > (numPhotos - 1))
{
count = 0;
}
if(PhotoList[count].content)
GetHolder(i).addChild(Loader(PhotoList[count]).content);
else
Globals.Debugger.text += "was null -- ";
count++;
}
this.mcContainer.play();
}
This method is called by the Event.COMPLETE event handler, so the content is there. This code will display the photo ONCE, in the last container it was assigned to, but I need to assign it to multiple containers...
I tried using a "duplicateMovieClip" method from a third party but it doesn't seem to support Loader too well. Anyone have any ideas?
Making Dynamically Created Movie Clips Instances Re-draggable
This is a Flash 8 / Actionscript 2 problem
The application allows the user to create multiple instances of a dot
by clicking on the original dot - and then drag the instances to position
them on the stage (it's part of a game)
I need to allow dots to be re-dragged - but to do that need to detect the
instance name of the dot under the mouse pointer (otherwise I can't turn
the dragging on)
this is what I've got so far...
numberOfDotDuplicates = 0;
dot.onPress = function()
{
numberOfDotDuplicates++ duplicateMovieClip(_root.dot,"dot"+numberOfDotDupl icates,getNextHighestDepth())
_root["dot" + numberOfDotDuplicates].startDrag(true);
}
/*
This bit below is not realy part of the problem
- but it feels like an inelegant workround
I've had to use a listener to stop the dragging
because the onRelease event is only detectable
if it happens over the original 'dot' (where the
corresponding onPress event was detected)
*/
var myListener:Object=new Object()
Mouse.addListener(myListener);
myListener.onMouseUp = function()
{
stopDrag();
}
Thanks for taking the time to read this
Simon
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
Shape Tweens, Graphic Symbols, Motion Tweens
I am working on learning assignment for school and i want to make sure i did this right. i do not have a manual to look this up.
i am supposed to use shape tweens, Could someone tell me a definition and how to create them.
I also need a definition between a graphic and raw artwork?
i am making a small animation and I need to use shape tweens using raw artwork? i used the rectangle tool and the brush tool and made a scene on its own layer. i did not convert it to a graohic symbol. is that an example of a shape tween or am i totally off? and it plays behind the motion tween animation i created on various other layers.
anyone?
Unique XML Help
I found a tutorial on XML and flash. However it only deals with dropping a bunch on nodes in a combo box or list. I need help figureing out how to do the following:
Lets say that I have an XML that looks like this,
<table>
<item id="4" email="email@blank.com" />
<item id="5" email="email2@blank.com" />
<item id="6" email="email3@blank.com" />
</table>
Now, what I want to be able to do is put a dynamic text field on the stage and say, give me the email address for the id=4. Then in a totally different dynamic text box, give me the email for id=5, and so on. These dynamix text fields will all me in the same frame, so I am wantign to use actionscript on the frame, but need the script that can put a certain attribute in an instance of a text box according to an id that I specify in the code. Can anybody help on this?
-Yours truly Ricky Bobby
Can Instances Be Attached To Instances ?
can instances be attached to instances using attach movie??
what i am doing is creating an instance of a movie by dragging and dropping and attaching a movie to a symbol and then i want to attach my new movie instance that i just created to another instance... can i do that...??
thanks
Accessing Clips Inside Clips Of Dynamically Generated Clips
Make sense?
So here's the code I'm working with. For loop generates clips containing clips. I need to access a specific clip (look_back) within the parent clip generated by the loop. Not sure how to do this.
Thanks // help appreciated
HTML Code:
var spacing1:Number = 10;
var lookA:Array = new Array();
function buildLooks(lookNum:Number) {
var looks:MovieClip = new MovieClip();
addChild(looks);
looks.x = 644;
looks.y = 64;
////////////////////
for (var i:Number = 0; i < 4; i++) {
var look:MovieClip = new Lookmc();
look.y = i*(look.height + spacing1);
look.name = "look"+i;
looks.addChild(look);
lookA.push(look);
lookA[i].look_title_txt.text = externalXML.look[lookNum].product[i].titles;
lookA[i].look_copy_txt.text = externalXML.look[lookNum].product[i].copy;
var url:String = externalXML.look[lookNum].product[i].image;
var urlReq:URLRequest = new URLRequest(url);
var lookImg:Loader = new Loader();
lookImg.load(urlReq);
lookA[i].addChild(lookImg);
var proLink:String = externalXML.look[lookNum].product[i].link;
var request:URLRequest = new URLRequest(proLink);
lookA[i].addEventListener(MouseEvent.MOUSE_OVER, onBtn0_Over);
lookA[i].addEventListener(MouseEvent.MOUSE_OUT, onBtn0_Out);
lookA[i].addEventListener(MouseEvent.CLICK, onBtn0_Click);
}
}
var activeBtn:MovieClip;
function onBtn0_Over(evt:MouseEvent):void {
trace(evt.target);
evt.target.look_back.alpha =0; // failed attempt
}
function onBtn0_Out(evt:MouseEvent):void {
evt.target.look_back.alpha =0; // failed attempt
}
function onBtn0_Click(evt:MouseEvent):void {
navigateToURL(request, "_self");
}
Unique Number
Can anyone point me in the right direction in creating a unique random number in the following series of 3 numbers.
I've tried various if and if else combinations but can't get it to work.
Thanks all.
on (press) {
a = Math.round(Math.random()*10)+1;
b = Math.round(Math.random()*10)+1;
c = Math.round(Math.random()*10)+1;
}
Unique Numbers
hi,
I'm doing a thing with randomized numbers. But I want each number only to appear once. I have a solution for it for numbers from 0-9 but then I don't know how to fix it.
This is the code I'm using to check up to nine... anybody know what changes I have to make to be abel to check for larger numbers?
i = Number(i)+1;
if (i<=antaltermer) {
do {
rnd = random(antaltermer);
x = 1;
while (Number(x)<>Number((Number(length(Temp))+1))) {
if substring(Temp, x, 1) eq rnd) {
rnd = "";
}
x = Number(x)+1;
}
if (rnd ne "") {
Temp = Temp add rnd;
}
} while (rnd=="");
gotoAndPlay (4);
} else {
gotoAndPlay (6);
}
Unique Problem? Please Help
Hello
I have designed a page that has a flash navigation
with this flash nav, it introduces itself with animation onto the html
page
now
for the buttons will link to other html pages on the website
but I want to keep this flash nav on each page
but I don't want the intro to start each time it goes to a new page
I just want it to go to the point where everything has stopped moving
and just the buttons and nav are static
I understand that in flash you put an action to a button to go to an html page but, how do you ALSO get it to go to a certain point in the movie as well as the html location
this is the address I have the flash nav for testing at
http://homepages.slingshot.co.nz/~mj77/cyl/index.htm
If anyone can please help, I hope I have explained to you can understand what I am trying to do
if I put an alternative .swf nav file the is still onto the other pages although this will solve the problem of skipping the animation part, a new .swf file will have to load
so I do not want this, or it will take too long for another downloaod
which is not user friendly
Unique Names
Okay I'll try and make this easy to understand.
the easiest way to explain is image your a director
about to make a movie you have:
100 diffrent names(50 guys 50 girls)
50 roles(non gender based)
I want to randomly grab 50 diffrent names and assign them
to the diffrent roles(randomly).
Thats easy enough using arrays and the Math.random assignment.
the code looks something like this.
guys =["Mike","Dave","luke","Raul","Steve","Tyron","Malco lm","Bobby","Ben","Johnny"];
girls =["Sandy","Holly","Mish","Liz","Samatha","Charlez"," Lucy","Rebbeca","Cassie","Monica"];
allNames =[guys,girls];
role = Array();
index = Math.round(Math.random()*(allNames.length-1));
player = allNames[index]
if(player == guys){
count = Math.round(Math.random()*(guys.length-1));
players =guys[count];
role.push(players);
}
if(player == girls){
count = Math.round(Math.random()*(girls.length-1));
players = girls[count];
role.push(players);
}
trace(players);
trace(cast);
mind you thats only retriving one name at the momment add a loop and I can make the amount required.
as you can see their is an array called role
which will also be parsed randomly to the 50 diffrent parts in the movie.
LOST YET I am just writting this.
I understand how to do all of this.
So to make a long question short ( I KNOW TO LATE);
I want to be able to keep the value of wither it was a guys name or a girls name. This part is needed later in order to determine the interaction between the user and the role.
The reason for this all is so that user's expericenes will change everytime they play (or appear to change);
that's what the 100 names and 50 roles is for.
I'm sorry if this makes no sense to you carry on and enjoy the rest of the board.
But for those who even get the faintest idea of what I'm trying to do your help would be immensely appreciated.
Thanks Fox.
Unique Problem...i Think...
I have a site built in flash. (One base .swf that loads other .swf's on top as "sections")
On my base .swf I have some text boxes with scrollers. (about 4 different ones in different scenes)
When I load a particular movie and then unload it, returning to the base, the scrollers on my base .swf dont work! Why??!!
I can load and unload other movies and this doesnt happen..
Any help would be appreciated.
A Unique Preloader
Hello,
On my site, i am trying to make a preloader. The preloader I am attempting to make involves a picture, which I attached to this thread. I want it to fill up from the bottom with red as the load progresses. I tried, since it is a transparent gif, to make it a mask over a vertical load bar. This did not work. Any help would be appreciated. The background of my site is also plain white.
Thanks
Unique Scroller
Hi..This is my first post on flash kit so I hope I dont sound stupid :-)..
I am making a site at the moment for a product design company called 257 and they have specifically requested a certain type of layout and scroll bar function, which I am very unsure how to do.
I have attached an image of the layout they want. The purple bar on the right side is draggable up and down like a normal scroller, however when it matches up with one of the corresponding page titles listed on the side it automatically scrolls the central content movie to that location on the page.. The central movie is just a long thin page with all the content for the site on it, it will all load dynamically or course..
But I just cant figure out how to make the scroll bar scroll to a certain position on the content movie. Is there a "play to frame 10 and stop" type action scrip I could use or does anyone know of a better way to do this. I really really need some help here.
Thanks guys
Jamie
Unique Identifier
Hi,
I'm just keeping track of some variable in flash. I write them to a text file.
at first I thought on using the ip and the variable, but ip's arent' that unique.
Does anyone have a script that will generate a unique identifier inside flash? that I can pass to my script.
Thanks
A Unique Search Bar
what i want to do is pretty specific. i want to have someone be able to type in a dorm name at my college, and after they hit a Submit button, i want the text they typed to match up with a picture of the dorm. for example, if someone types in South House, and then hits submit, i want an .swf with a picture of South House to load. can anyone help me out? i have no idea how to code it.
A Unique Forum
Dear braders and sisters,
I am planning to open a dicussion forum. But I do know from where I should begin. I had visited a couple of webhosting sites, but it was difficult to make a choice.
maybe you can give me general and reliable information about how to open/create a dicussion forum. Step by step, plz.
I just want to open a unique dicussion forum, with good look and high quality!
I am looking forward to hearing something from you very soon.
Thanks in advance,
superior
Generate Unique Id
i am trying to create some user
colour background preferences in a flash file,
and store them on a server.
so everytime they come back to the flash site
on their initial set up,
flash reads the settings from the server and
sets the flash colour background according to
the preferences.
quite like a cookie in html.
so somehow i need to create a unique id on every set up.
the easiest would be to get people to register and send
them an id back from php.
but i don't want them to have to register.
so i wondered, is there a way to create a unique id
from whithin flash, based on the system id, os or similar?
i had a lood at 'System.capabilities.version' etc,
but none of those options seem to return a unique id.
anyone any ideas?
Help With A Unique Problem.
I am building business card maker, and basically have it all finished, but I noticed one small problem. Basically, the user plugs in all their information into input text boxes, and then can 'proof' their business card by generating it into a PDF. I then have a gotoandplay function goto a new frame, where the user plugs in their Email address, name, how they found the website, blah blah blah. Well then, I want them to submit the business card again, and the variables will be pulled from the old input text boxes from the previous frame. So in order to do this, I have only found its possible by 'hiding' the old input text boxes frame with a large box with new input text boxes for the 'questions' part of the process. However, if the user tabs through the text boxes, they will be able to hit the OLD input text boxes, and can potentially screw up their business card. Now, if I run them on completley different frames, and I try to submit the business card, I get the error
Code:
Error #1009: Cannot access a property or method of a null object reference.
since it cannot call the text input boxes from the old frames.
I hope this doesn't sound incredibly confusing, I just need either a NEW way to handle the calling of the variables, OR a way to make it so they cant tab onto text fields that aren't like visible.
Unique Numbers
I am a newbie to actionscript (programming in general) and I am trying to accomplish the following but don't know how to do it.
I have an array which starts out with 3 unique numbers between 1 and 30.
For example :
myArray = new Array();
myArray[0] = 13;
myArray[1] = 22;
myArray[2] = 29;
OK, a bit further down on my movie timeline, I will need to add 3 additional unique numbers to this array which are also between 1 and 30, but cannot be duplicates of the first three. In other words, when all is said and done, the total 6 numbers have to be unique numbers between 1 and 30.
A Unique Hit Test
Can I use shapeflag in a creative method to track hittests of multiple stragely-shaped movie clips? My case is a simple one; one movie clip is a line, and the other can be any of a wide variety of shapes. Now I'd say it's unreasonable to check every single pixel on one shape with each pixel one the other.
Just for the purpose of typing forum code, let's say that the shape MC needs to use removeMovieClip(); when touching the line.
My backup plan is to insert into the line movie clip a single blank mc, which moves itself up the line and checks for a hittest with the shape MC each time. Seems okay, but I'd probably sacrifice a little speed that way.
Note that this line rotates regularly in its environment. A 'hotspot' hittest won't do it . . . until someone else figures it out, I'm going to have to wing it on this project (I have other things to do with it).
Thanks in advance, even though I'll thank you again later.
[FMX] Unique Identifier On .txt?
Hi kirupa folks. first post!
i have an externally loaded .swf file i'm loading into a container mc with a unique identifier. that .swf file itself is dynamically loading a .txt file into a text box.
how do you script the .txt file to have a random identifier? a code on the actual .txt file or actionscript on the buttons that call the .txt file?
i have a few buttons that when pressed load a new .txt file into the text box called newsBox. the buttons have this code:
on (release) {
loadText = new loadVars();
loadText.load("newsitem1.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
newsBox.html = true;
newsBox.htmlText = this.content;
}
};
}
what i want to make sure is that when called upon, the new .txt file is loaded and not the one on the user's cache.
any help or clarification on this would be GREATLY appreciated!
Unique Menu Bar
Hi everyone,
I would say I'm fairly proficient in AS 2.0, but I can't seem to achieve the effect provided as "goal."
The CD's that came with the Flash CS3 software, only showed how it was integrated with all the other adobe software and seldom touched tutorials on how to achieve certain effects such as this:
Goal:
I'm trying to mimic a certain menu bar found here: http://www.duo.co.kr/html/main_img_08/menu.swf
My Current Bar:
I've tried to mimic it...
http://img219.imageshack.us/my.php?image=navbarkd6.swf
I would love to make each sub-drop down menus as buttons and the highlight of each link colored to red by A.S. if possible.
For my code I have used what I found in kirupa's tutorials, all the comments have been preserved,
PHP Code:
//all this code is inside the complex button so you can stick as many as you want //on the stage and all will work.. they all will have this code in it..stop(); // stop the movie clip from playing (stop button from growing, we want that when the mouse rolls over only this.onEnterFrame = function(){ if(rewind == true){ //if rewind switch is set to true play backwards prevFrame(); // play backwards }}this.onRollOver = function(){ rewind = false; //set variable (or switch) that decides wether ot not to play backwards... play(); // play this movie clip.. (grow the button(tween));}this.onRollOut = function(){ rewind = true; //set or rewind switch to true so it will play backwards...}this.onRelease = function(){ //getURL("http://www.kirupa.com","_blank");}
If I can be offered some sort of direction on how to achieve such effect I'd appreciate it.
Most searches from google "flash drop down", "menu drop down" etc...
Gave me: flash link generators, purchasable flash links, etc...
p.s. I'm using Flash CS3, but I've saved the attachment with a Flash 8 setting.
Random Unique
Hi
I am looking for help in develping my new project which involves selecting numbers, both randomly and uniqely. I have on stage 128 dynamic text boxes named myTextField1, myTextField2 etc etc up to 128, and I want to fill each box with a unique number from 1-128
I would like to use a button to run this code and if possible to fill each box individually that is box1 then box2 etc.
This is the code I am trying run but I cannot get it to give me 128 different numbers, it fills the fields ok but there are duplicates.
Code:
for (i=1; i<129; i++) {
var temp:TextField = _root["myTextField" + i];
temp.text = randFun();
}
function randFun() {
var randomPick:Number = Math.ceil(Math.random()*128);
return randomPick;
}
Any help please
Bern
Unique Identifier
Can someone please explain how to apply this script to my movie...Kirupa says it makes sure your visitir doesn't load a cached version of your movie. Where does it go? What is the math method for?
[as]
myIdentifier=Math.round(Math.random()*10000);
loadMovie("myAnim.swf?uniq="+myIdentifier,1);
[as]
A Unique Hit Test
Can I use shapeflag in a creative method to track hittests of multiple stragely-shaped movie clips? My case is a simple one; one movie clip is a line, and the other can be any of a wide variety of shapes. Now I'd say it's unreasonable to check every single pixel on one shape with each pixel one the other.
Just for the purpose of typing forum code, let's say that the shape MC needs to use removeMovieClip(); when touching the line.
My backup plan is to insert into the line movie clip a single blank mc, which moves itself up the line and checks for a hittest with the shape MC each time. Seems okay, but I'd probably sacrifice a little speed that way.
Note that this line rotates regularly in its environment. A 'hotspot' hittest won't do it . . . until someone else figures it out, I'm going to have to wing it on this project (I have other things to do with it).
Thanks in advance, even though I'll thank you again later.
[FMX] Unique Identifier On .txt?
Hi kirupa folks. first post!
i have an externally loaded .swf file i'm loading into a container mc with a unique identifier. that .swf file itself is dynamically loading a .txt file into a text box.
how do you script the .txt file to have a random identifier? a code on the actual .txt file or actionscript on the buttons that call the .txt file?
i have a few buttons that when pressed load a new .txt file into the text box called newsBox. the buttons have this code:
on (release) {
loadText = new loadVars();
loadText.load("newsitem1.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
newsBox.html = true;
newsBox.htmlText = this.content;
}
};
}
what i want to make sure is that when called upon, the new .txt file is loaded and not the one on the user's cache.
any help or clarification on this would be GREATLY appreciated!
Unique Visitors Using PHP
Hi,
Can someone please tell me how to find unique visitors to my Flash site
I am already using PHP to have a hit counter, but I want to also record unique users, so I guess I need to also record some information from the users machine (?) when they visit. I suspect I can also use PHP to do this, the only problem is I cannot store info in database, as I cannot use mySQL with my hosting company.
Is there a way I can store user information in a text file, and just append a record each time a new unique visitors comes to my site?
(there are not going to be large numbers of visitors to my site at launch (and when there is and a txt file becomes unmanageable, I will switch hosting companies so I can do it with a database).
Any help VERY much appreciated. I am a complete novice to Flash and PHP etc.
RM
Unique URL For Flv's In Xml List
What I'm trying to do is send someone a link to a specfic video in a xml play list (similar to Lee's xml video playlist). If the video is not the first in a list, how can I create a unique link without creating a new flash movie or a new playlist? Any ideas. Thanks,
~K
|