[MX] Cant Make Function Work
I was reading Kirupa Chinnathambi's function tutorial and I was trying to make my own function, but it's not working! Here it is:
Code: move = function (finalX, finalY, k) { cX = this._x; cY = this._y; difX = cX-finalX; difY = cY-finalY; setProperty(this, _x, cX-(difX/k)); setProperty(this, _y, cY-(difY/k)); }
_root.btn.onRelease = function() { _root.ball.move ("200", "200", "5"); } thanks for the help!
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 06-01-2004, 05:35 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Make A Function Work Only Once
hello is there a way to make a function only work once reguardless of how many times its called after that one time?
Thanks
[MX] Cant Make Function Work
I was reading Kirupa Chinnathambi's function tutorial and I was trying to make my own function, but it's not working! Here it is:
Code:
move = function (finalX, finalY, k) {
cX = this._x;
cY = this._y;
difX = cX-finalX;
difY = cY-finalY;
setProperty(this, _x, cX-(difX/k));
setProperty(this, _y, cY-(difY/k));
}
_root.btn.onRelease = function() {
_root.ball.move ("200", "200", "5");
}
thanks for the help!
Grrr... How Do I Make This Function Work?
Hi, tis me again ... I have the following function :
code:
function Spray() {
for (i=0; i<=10; i++) {
duplicateMovieClip(particle, particle+i, i);
scale = random(150)+50;
yVel = random(7)+1;
xVel = random(20)-10;
_root.particle._xscale = scale;
_root.particle._yscale = scale;
peak = 50;
drop = false;
_root.particle._x += xVel;
//above here is what needs to initilize, and below is what need to constantly reapply
if (!drop) {
_root.particle._y -= yVel;
trace("systems nominal");
if (_root.particle._y<=peak) {
drop = true;
}
}
if (drop) {
_root.particle._y += yVel;
trace("la la la");
}
}
}
Spray();
anyway, I tried a couple of ways to make the veriables initialize diffrently for each duplicate, and then constantly applaying the bit of code that makes the particle go up and down, and compact all this in a single function.
can anyone tell me how to do this?
thanks in advance.
Typer Effect Works... But Can't Make It Work As Function()
oh.. i created an mc with typer effect. it works by typing out the text in the dynamic text box that you want displayed, and then shows each letter one by one using onClipEvent (load) and onClipEvent (enterFrame) that is attached to an empty clip within the typer mc
I tried to create a function to do the same thing but i can't get it working.
Eventually what i want to do is create an array of different texts, and have it display one item, clear the box, and move on to the next. Then when it reaches the last array item, move on in the timeline (i.e. _root.gotoAndPlay(); )
i'll stick this code in here, but i also attached a sample file so you can see what i'm doing...
Code:
onClipEvent (load) {
g = _parent.txt; //txt is the variable name of the textfield which contains the text to be displayed
i = 0;
lastIndex = g.length;
_parent.txt = "";
}
onClipEvent (enterFrame) {
if (i<lastIndex) {
_parent.txt += g.substring(i, i+1);
i++;
}
}
//this was my function attempt, which resides on frame 1 of the typer mc
//
function write(T) {
T = this.displayTxt.text; // displayTxt is instance name of text field
g = T;
i = 0;
lastIndex = g.length;
this.displayTxt.text = "";
this.onEnterFrame = function() {
if (i<lastIndex) {
T += g.substring(i, i+1);
i++;
} else {
delete this.onEnterFrame;
}
};
}
//
this.write("typewriter text i want to type out");
//also i tried to call the function from the main timeline like this:
_root.typer2.write("typewriter text i want to type out, typewriter text i want to type out");
any help would be appreciated... thanks
and if anyone has an idea of how i can incorporate an array into this.. that would be great too..
Thanks in advance
How Can You Make Sure One Function Completes Before Second Function Runs?
Hi guys:
I apologize if it's a really obvious answer, but I can't even think of the right terms to search on right now!
I have two functions. One is an xml connector trigger, that calls a PHP program to get xml data that includes content and formatting information. It will read the formatting information into hidden text fields.
The second function reads the hidden text fields, and applies the data from them to the style for the content fields:
Here's the prototype (pooh just being a "foo" name), contained in the root of the application:
Code:
// Initial poll for the XML data (this also runs the PHP that updates the movie)
var f_xml_trigger:Function = function(){
xml_community_board_connector.trigger();
}
_global.f_xml_trigger = f_xml_trigger;
// Function to apply styles:
var f_format:Function = function(){
Dashboard_Message_TextArea.setStyle("backgroundColor",Pooh.text);
}
_global.f_format = f_format;
_global.f_xml_trigger();
_global.f_format();
What's happening is _global.f_format is running before _global.f_xml_trigger has completed populating the fields.
I made these Global so a movie clip that's running a clock can periodically check for and apply updated content & formatting.
Code:
function getTime() {
var time = new Date();
<snip>
var second = time.getSeconds();
<snip>
if (second == 30 && _global.t30flag == 1)
{
// The _global.t30flag is used to make sure this only runs once
// otherwise it would run at the frame per second rate (i.e. 12fps = 12 times
// during the 30th second
_global.f_xml_trigger();
_global.t30flag++;
}
if (second == 31 && _global.t30flag == 2)
{
// Apply the formatting brought down by the xml trigger.
// Can't be done at the same time, because it runs before the values are updated.
_global.f_format();
_global.t30flag++;
}
<snip>
But rather than depending on frame numbers or seconds (especially since a 1 second delay between when text changes and formatting changes is annoying to say the least!)...I would think there must be a way that as soon as we can get a success returned from _global.f_xml_trigger we can run _global.f_format.
Any suggestions?
Thanks,
Matt
:: HELP ::: About Call Function First Time, Y Dont Work ? Next Time Work
http://202.57.150.77:8083/index.html
c at product click particle mdf or hdf then c animation wasnt play at first time y not ?
Code:
_root.readDB();
_root.onData = function() {
_root.selectLang();
PlayAnimate();
};
Code:
function PlayAnimate() {
for (i=1; i<=6; i++) {
if (this["obj" + i].mystate==_root.lastKeyAccess) {
deepMc = deepMc + 1;
duplicateMovieClip("theAnimate", deepMc, deepMc + 100);
this[deepmc]._x = this["obj" + i].mcx;
this[deepmc]._y = this["obj" + i].mcy;
this[deepmc]._visible = true;
this[deepmc].gotoAndPlay(1);
this[deepmc].PName = _root.lastKeyAccess;
}
}
}
HOW DO I MAKE IT WORK WITH THE PC?
Hello. I am a first time emailer, love the topic and love the show. (a little ice breaker)
I am currently creating a presentation to be distributed on the web and on CD's. I have created the presentation on a mac and need to make it so it will play on a PC on a CD. How do I do that? I was told I could but I just don't know how.
Please help.
thanks a bunch.
Plz Make My Mc Work
i've created 2 mc animation with no scripting inside.. on the main time line, mc1 is in frame 1 and mc2 is in frame 2.
i've added a stop action to frame1 so it plays mc1. but i can't get mc2 to work?
How do i make mc2 to play after mc1 has finished and then loops back again?
plz help..this newbie it going crazyeeeeeeeeee!!
Can Anyone Make This Work?
I am trying to figure out how to do exactly what is in this tutorial, but it won't work for me. Can someone try it out and see if it works. I'm sure I am just making a mistake somewhere, but I don't know where. Thanks
http://www.tek-tips.com/gfaqs.cfm/spid/250/sfid/1292
Can Anyone Make This Work?
I have torn my hair out on this one. My dreads look like little worms coming out of my head now.
I'm using Flash MX, but I started this in Flash 5.
I have a radio, that loads an external file that holds the sound clips. I also have a preload movie that should loop until the external sound file loads.
In preview, the sounds load, but the preloader doesn't, on the Web neither works...
Can anyone take my poor newbie hand & pull my pitiful buttout of this hole?
Please download my swf files and make a working file from this abortion.
I don't understand debugging well enough to figure out where this is failing.
The opening script looks good, and I think the external file is loading... it seems to work on my local test, but from the Web nothing works.
Please download these two files and make it work, then tell me where the screw up is.
.fla Files are at:
http://www.thenewmatics.com/FlashData/
I am beyond confused, is there a FlashMaster that can fix this simple problem and send me the corrected files?
Others have looked at this, sent me scripts to fix it, but stll the compiled files don't work. THere seems to be a big difference between local test and final output.
Help please....
Can Anyone Make This Work
Okay banner ad for a site but the guy want the .swf's in it own folder
well take a look and tell me what is wroung and how to fix it
good one
good one but in the same folder
Bad one but swf in it's own folder
bad one but he want's it like this
What gives
Make It Work...
I am using
on (release) {
getURL("java script:window.open(' http://www.angelfire.com/d20/divinemedia/oe/join.html', 'main', 'features');void(0);");
}
It will open the window but how do i size it?
Please help me out and thanks for your time - dm
How Can I Make This Work?
Hi,
I’m trying to write a piece of script in which I eventually want to end up with an array nummerGetrokken containing 5 elements, and none of the elements can be the same. Let’s say antwoord_fout.length = 11
I'm working with flash MX.
I want to combine these two steps but i don’t know how I think i have to make a loop or something but again, i don’t know how
1. Create a random number (the max. value of number is antwoord_fout.length-1, and theminumum is 0)
By doing this:
nummer = Math.floor(Math.random()*(antwoord_fout.length-1))
2. Check whether the variable nummer is already in the array nummerGetrokken
If it isn’t the number that has been chosen must be added to the array nummerGetrokken
By doing this function:
function searchArray (nummerGetrokken,nummer){
for (var i = 0 ; i <nummerGetrokken.length; i++){
if (nummerGetrokken[i] == nummer){
return i;
}
}
return null;
}
if you start this function this should happen:
searchArray ();
if (searchArray (nummerGetrokken.nummer) == null);
nummerGetrokken.push (nummer);
// here you have to go back to step 1 and then step 2…if the array nummerGetrokken doesnt hold 5 elements yet
}
else{
// here you have to go back to step 1 and then step 2…if the array nummerGetrokken doesnt hold 5 elements yet
}
ok where the comment //here you have to go back to step 1 and then step 2…
that’s where i don’t know what to write! in words it would be
something like “go to step 1 and then to step 2 if the array nummerGetrokken doesnt hold 5 elements yet”
Eventually I want to end up with an array nummerGetrokken holding 5 elements, and none of the elements can be the same. Let’s say antwoord_fout.length = 11 and then it could come up with for example:
NummerGetrokken = [2,9,5,4,1]
thanx in advance,
Gelfling5775
How Can I Make This Work
i was given this file very kindly by someone. not knowing actionscript how can a make it plat as a .swf. at the moment it gives the required feed back in an output box, but i want the fed back to appear all on the same screen.
thank you if you can help.
Cant Make Get-url To Work?
Hey again :-)
i'm almost done with my standalone CD-rom
but i have included a few links, but i cant get them to work.
they open my browser fine.... :-) nice
but the respected link dosent load in the browser??? why???
this is the code i've used...:
on (release) {
getURL("http://www.tv-glad.dk", "_blank");
}
and i also want a email link to open the mail program with the email adress in a NEW MESSAGE, ready to send.
it opens the browser insted...and nothing happens.
how should the code look like?
Thanks
Mirrorman
Can You Make This Work?
alright, i am trying to make this code do the same thing only using setInterval instead of onEnterFrame but i cant get it to work.
i have MC's called "b0","b1"...
Code:
for (j=0; j<5; j++) {
temp = _root["b"+j];
temp.name = j;
temp.quickPop = 10+j;
temp.tx = 777;
temp.useHandCursor = false;
temp.onEnterFrame = menuMove;
temp.onRelease = menuLoad;
}
ive been trying something like this to replace the onEnterFrame line:
Code:
setInterval(function () {
temp.menuMove();
}, 30);
I Can't Make It Work :(
I'm trying to make a flying string, I think it's simple but I'm really stuck.
Please help me.
I Can't Make This Work.....
Hello all,
I have tried a whole pile of different ways but I can't seem to get this "news ticker" to work inside a movie clip. If one of you crazy Flash Gurus out there can help, I would really appreciate it.
The news ticker is supposed to be in the footer of my flash site, and all of my buttons and stuff are Movie Clips. It was a late edition to the site and now I don't know how to get it to work in a movie clip so that it can sit on the first frame.
I used lame tweening to make the text move because I can't figure out how to do it dynamically. I know this is a BIG order, but I also know alot of you out there could help.
Thanks in advance,
~Shady0ne
Cant Make This Work
onClipEvent (mouseDown) {
if (_root.blok.hitTest(_root.handw-gunn)) {
gotoAndStop(1);
}
else{
gotoAndPlay(1);
}
}
Basically, what is supposed to happen is that if 'blok' and 'handw-gunn' touch, the movie clip with this code in it is not supposed to do anything when the mouse is Down. But if they are not touching and if the mouse is Down, it plays. The 'else' part of this works, but not the 'if' part. If you could fix it or give me an easier method for this, it would help.
Make Work+log In+box
i have a login box made in flash, but i need a way to pass the form variables from flash to php so i can check them. do you know of any way to do this?
Make Something Work With A Key
wat do i replace "scrollbar_mc.up_btn.onPress = function ()" with to make it so that when u scroll down with the mouse wheel it works?
How Can I Make This Work?
I get this error:
"Left side of assignment operator must be variable or property."
With this code:
Code:
function mymover() {
for (c=0; c<8; c++) {
"obj"+c._y = 55; //doesn't work
}
obj4._y = 44; //works!
}
How can I make it so the for loop will go thru all my objects (obj1, obj2, obj3, etc.)?
How Can I Make This Work?
Hi,
Im trying to make a movieclip called energyBall_mc bounce round the stage without leaving the stage.
I have the following code but it has an obviouse problem.
Code:
var speed:int = 10;
var myTimer:Timer = new Timer(10);
myTimer.addEventListener(TimerEvent.TIMER, runAni);
myTimer.start();
function runAni(event:TimerEvent):void{
if(energyBall_mc.x > 395){
energyBall_mc.x -= speed;
}
if(energyBall_mc.x < 5){
energyBall_mc.x += speed;
}
if(energyBall_mc.y < 0.8){
energyBall_mc.y += speed;
}
if(energyBall_mc.y > 243){
energyBall_mc.y -= speed;
}
}
Thanks.
I Can't.. I Can't... I Can't Make It Work :(
Hello and thankyou for reading my post
I have an eclectic collection of code powering my soon to be "Links" page, it is rather simple I am afraid yet i can still not get my url links to function, I click them they beep but no window will open
If anyone can please take a look at the /fla i have placed online I would be etrnally grateful
http://www.spikeydog.net/stuff/links.fla
Any suggestion / solutions would be greatly appreciated.
Many Thanks
Pip
How Can Make This Work
ActionScript Code:
getNewText1 = ["textLine1","<BR>textLine2","<BR>textLine3","<BR>textLine4"
]
getNewText2 = ["textLine6","<BR>textLine7","<BR>textLine8","<BR>textLine9"
]
var getTextNum = 1
nextPrev.nexts.onRelease = function(){
//appProvider.AppProvTxt = getNewText
getTextNum = getTextNum = +1
textFlow(["getNewText"+1]);
}
nextPrev.prevs.onRelease = function(){
getTextNum = getTextNum = -1
textFlow(["getNewText"+1]);
}
Pretty simple just trying to get next or previous variable.
I have done it before but don't know why can't i get it now
Thanks
How Do I Make This Work?
ok I'm trying to put all my code into classes
here is my class
package {
import flash.display.*;
import flash.net.URLRequest;
import fl.transitions.Tween;
import fl.transitions.easing.*;
public class displayWins extends Sprite {
public function displayWins() {
trace("got here");
var aloader:Loader = new Loader();
addChild(aloader);
aloader.load(new URLRequest("element1.png"));
aloader.name=("a1");
aloader.x=0;
aloader.y=0;
var bloader:Loader = new Loader();
addChild(bloader);
bloader.load(new URLRequest("element2.png"));
bloader.name=("b1");
bloader.x=0;
bloader.y=124;
var myTween:Tween = new Tween(aloader, "y", Back.easeOut, aloader.y, (aloader.y+124), 3, true);
var myTween1:Tween = new Tween(bloader, "y", Back.easeOut, bloader.y, (bloader.y+124), 3, true);
}
}
}
how do I access it from my app and make it show thse images on the screen and do the tween in the fucntion
I know this is basic but I cant work it out.
regards
How To Make This Work For FMS
Here is some AS3 code that works for creating a video and playing it from a local file. How can I change this to work for streaming from FMS?
Back in AS2 I just changed out "null" for my rtmp server address and removed the .flv extension and it worked. I tried to do the same thing with this AS3 script which I got from gotoandlearn.com and it doesn't work, and I get the error below when I test the movie.
ArgumentError: Error #2126: NetConnection object must be connected.
at flash.net::NetStream/construct()
at flash.net::NetStream()
at CentralMiniAS3_fla::MainTimeline/frame1()
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Connect.Failed
at CentralMiniAS3_fla::MainTimeline/frame1()
Code:
var video:Video = new Video(384,216);
video.x = 20;
video.y = 20;
addChild(video);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
function onStatusEvent(stat:Object):void{
trace(stat.info.code);
}
var meta:Object = new Object();
meta.onMetaData = function(meta:Object){
trace(meta.duration);
}
ns.client = meta;
video.attachNetStream(ns);
ns.play("cheesecake_high.flv");
How Do I Make This Work?
I am using a dynamic Flash site with XML. I am trying to trace the image selection through Flash and pass the info along to a php document to create a new full size popup version of the thumbnail. In flash I am using:
on (release) {
trace(("zzz> " + fullzoom));
getURL((("javascript:OpenURL('images/" + fullzoom) + "')"));
}
What do I need to put into a php document to read the passed info and display the image?
Cant Make It Work
i install flash player but it doesnt want do work
my account is an administrator
i uninstalled it and installed it agein with no result
what do i do now ?
Why Won't My Function Work?
I have created a simple function which is placed in the root of frame 1 (currently the only frame). But whenever I call it (from inside a movieclip), it doesn't work as it should do. The function is:
Code:
function notify(net, prot, elet) {
if (net=1) {
/:tneu=/:tneu+1;
net = 0;
} else if (prot=1) {
/:tpro=/:tpro+1;
prot = 0;
} else if (elet=1) {
/:tele=/:tele+1;
elet = 0;
}
}
and it is called using:
/:notify(0,1,0);
The problem is that the function always executes as if net=1, even when the arguments are (0,1,0). Thanks in advance.
Ade
Why Does My Function Not Work
Just getting this out the way. Please don't ask me to rearrange things or put the function in the main timeline because I have things where I want them:|
I have an MC "webloganime" and inside that I have another MC "calendar", and inside that another MC "day". Inside "day" I have a function (lets call it "function)". I put a simple trace inside funtion but when I call it from _root.webloganime.calendar.day.funtion(); it doesn't work! (I do'nt get a trace back) I can put it in the main timeline and call it from there _root.function();
But it doesn't seem to work anywhere else. I can extract variables from day and modify dynamic text etc so I don't think my path is incorrect.... It even shows up as a function when I list variables. I'm at my wits end on this. Maybe it is the way I am declaring the functino in flash mx 2004 or the player? I am doign it this way
function functionName(){
something soemthing
}
in the first frame of MC "day". Any help is appreciated!
Trying To Get This Function To Work.
I have a button which initiates a function called: "Handler" Like this :
on(release){
Handle(this._name);
}
The function looks like this :
function Handle(id) {
if (id == "item01") {
_root.MC1.gotoAndStop("on");
}
}
"id" is a variable for a dynamic text box, it's contents will change. But for this test the contents read "item01".
It doesn't work, can anyone offer any insight into this ??
Thanks.
Function Should Work.....
but doesnt
code:
function ease(endy,speed){
onEnterFrame=function(){
trace("still going");
_x += (endx-_x)/speed;
_y += (endy-_y)/speed;
if (Math.abs(this._x - this.endx)<0.5 && Math.abs(this._y- this.endy)< 0.25){
_y=endy
_x=endx
delete ease()
}
}
}
then its
code:
on(release){
_root.menu.dropdown.ease(35,4);
}
[F8] Please Have A Look: Function Won't Work
Can anyone tell me why the following function won't work?
code:
for(var i:Number=0; i==lv.TotalNum; i++){
this["var mainMC" + i + ":MovieClip"] = this.createEmptyMovieClip("mainMC" + i, this.getNextHighestDepth());
};
Function Only Work For 1 Mc
hi guys,
this is a weird situation i currently face. hope you can help.
i had define a function and it works fine. my problem is when i assign it to say 3 mc, it only work with the latest mc.
Code:
function goRight(m:MovieClip){onEnterFrame=function(){m._x++;}};
goRight(mc1);
goRight(mc2);
goRight(mc3);
and only mc3 is moving. is there a way to work around it??
thanks!
Why Won't This Function Work Twice?
PHP Code:
n = ["saab.jpg", "polo.jpg", "golf.jpg", "x_type_estate.jpg", "jag_us.jpg", "renault_clio.jpg", "porsche.jpg", "laguna.jpg"];
function loadthumbs(x, ext, lev) {
th = _root.createEmptyMovieClip('thumbholder'+ext, lev);
th._x = x;
th.createEmptyMovieClip('holder', 1);
for (i=0; i<(n.length); i++) {
ypos += 90;
th.holder.createEmptyMovieClip(['t'+i], i);
th.holder['t'+i].createEmptyMovieClip('img', 1);
th.holder['t'+i].img.loadMovie('http://www.charliekassel.com/_joncox/exterior/'+n[i]);
with (th.holder['t'+i]) {
_y = ypos;
_x = 10;
}
}
}
loadthumbs(0, 1, 1);
loadthumbs(300, 2, 2);
Why Won't My Function Work?
hi
why won't my below script work?
the movie clip is called "blue"
and i want it to move useing a function in a function
is it posible?
--------------------------------------------------
blue.onEnterFrame = function() {
movestop(this._x, 10, 500);
// movestop function
function movestop(thing, speed, dist) {
thing += speed;
}
};
----------------------------------------------------------------
if i go
blue.onEnterFrame = function() {
this._x+=10;
}
then it works
thanks
Andrew
Function Won't Work
Hi all,
I'm having the weirdest thing happen (or not as the case may be). Let me start by saying I'm not proficient in Actionscript and don't even use it that much, but writing a function and telling it to run doesn't seem like it should be this hard. My code is below and my problem is basically that the function won't run. Everything seems correct, but no matter what I do I can't get anything inside the function to display.
*******************************************************
path = _root.flvLink; //Assign variable to the info we passed it from the html
//flv_path = 'test.flv'; //Use for testing, when not running from an html page
path = path.split(".");
path = path[0];
num_images = _root.slides; //Assign variable to the info we passed it from the html
num_images = 1; //Use for testing, when not running from an html page
// convert num_images into a number (I'm not sure what it comes in as, but it's not a number)
num_images = Number(num_images);
//if no slides are in the video just skip right to the video, no preloading required
if(num_images == 0 || num_images == undefined){
nextScene();trace("nextScene");
}
else {
trace("else");
i = 97;
function loadImage() {
trace("in loadImage()");
/*
//converts the number into a string, 97 is lowercase 'a'
string = String.fromCharCode(i);
// This assigns the name of the image with an identifier after it
png_path = path + '_' + string + '.png';
test=num_images+":"+png_path;
// Set the location of the content to be loaded. Examples are:
myLoader.contentPath = png_path;
// Increase i
i++;*/
}
// Create a listener object event function. The progress bar is an object so it needs an object function to work
myProgressBarListener = new Object();
// When the progress bar is complete and has preloaded the loader component content, the listener will call and run this code below:
myProgressBarListener = function (eventObject) {
trace("i: " + i);
if(i < num_images + 96) {
loadImage();
trace("test");
}
else {
// Go to the next scene
nextScene();
}
};
trace("before loadImage()");
// Call the above function
loadImage;
trace("after loadImage()");
// Finds all the images and loads them into the loader
//for (i=97; i < num_images + 97; i++) {}
// Declares a listener that detects when the progress bar component has loaded the loader component content and is complete. Then calls the function myProgressBarListener
myProgressBar.addEventListener("complete", myProgressBarListener);
// Set up the progress bar component variable to polled mode which determines the maths behind the % counter.
myProgressBar.mode = "polled";
// The location of the Loader Component
myProgressBar.source = "myLoader";
// Sets the conversion to 1. This basically means the component divides the current and total values loaded and to be loaded. Then it floors them (works out the difference between them) and displays the converted value in the label property
myProgressBar.conversion = "1";
// Set the label to display the word 'loading' followed by the percentage value loaded so far
myProgressBar.label = "LOADING %3%%";
// The direction the progress bar moves when loading
myProgressBar.direction = "right";
// The location of the label that displays the percentage loaded so far
myProgressBar.labelPlacement = "bottom";
// Stops the Playhead in the current frame until the Movie has been preloaded
stop();
}
How Does A Function Work?
Hallo,
sorry for the dumb question, I am no code geek unfortunately.
The question is: writing
ActionScript Code:
this.onEnterFrame = function()
{
a++;
b++;
}
is like writing
ActionScript Code:
this.onEnterFrame = a++;
this.onEnterFrame = b++;
?
That is, in this case function is solely for the purpose of grouping instructions?
And, if I write
ActionScript Code:
this.onEnterFrame = function()
{
a++;
b++;
return 1;
}
The a and b index increasing does still occur? And, where does the '1' value go? That is, where can I fetch it?
Thank you for my basic questions, I think if I want to build a solid flash knowledge, I can't skip these. And the MM flash manual is IMHO very geeky.
m.
Can I Make This A Function?
I have this code I downloaded of a tutorial attatched to about 15 MC's.
I would like to declare the function just once and have the MC's call that function--then I don't have to attach the entire code to EVERY MC.
Here's the original code that works as long as I put it on each and every MC..
onClipEvent (load) {
this.elasticScale = function(tar, accel, convert) {
xScale = xScale*accel+(tar-this._xscale)*convert;
yScale = yScale*accel+(tar-this._yscale)*convert;
this._xscale += xScale;
this._yscale += yScale;
};
}
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.elasticScale(110, 0.7, 0.4);
} else if (!this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.elasticScale(100, 0.7, 0.4);
}
}
Here's what I tried to use and could'nt get it to work:
I put this on the first frame
function elasticScale() {
xScale = xScale*accel+(tar-this._xscale)*convert;
yScale = yScale*accel+(tar-this._yscale)*convert;
this._xscale += xScale;
this._yscale += yScale;
}
then I put this on the MC's
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.elasticScale(110, 0.7, 0.4);
} else if (!this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.elasticScale(100, 0.7, 0.4);
}
Can I Make A Function For This?
Hello,
I'm building an imagegallery using xml.
link: http://www.theremedy.be/fotos/
My problem. I want the thumbnails to fade in and out onRollOver instead of jumping to values like they do now.
So I probably need some kind of function wich I call when that particular button is rollOvered.
I currently use this code.
Code:
for (p=0; p<_root.thumbs.totalSlides; p++) {
_root.thumbs["btn"+p].p = p;
_root.thumbs["btn"+p].onRollOver = function() {
_root.thumbs["mc"+this.p].screen._alpha = 80;
};
_root.thumbs["btn"+p].onRollOut = function() {
_root.thumbs["mc"+this.p].screen._alpha = 0;
};
_root.thumbs["btn"+p].onRelease = function() {
loadMovie(data_xml[this.p].attributes.foto, _root["beeld"]);
_root.thumbs._visible = false;
};
}
Movieclips are placed on the stage using attachMovie.
So basically the question. Can someone help me with creating a function for the fading wich I can call on rollover.
Thank you.
//nevermind. Changed to flashplayer 7 export settings and used the build-in mx tweens.
5 Function Make It Just One
Happy New Year ::: 2004 ::::
hi guys...
if i have 5 function and i want to make them in just one.... the difference between them just in the name of the movie clip....
here Exp. for 3 :
ActionScript Code:
function homeClickreturn() { if (_root.mc_apLink1._currentframe == 10) { _root.mc_apLink1.play(); }}function homeClickreturn2() { if (_root.mc_apLink2._currentframe == 10) { _root.mc_apLink2.play(); } if (_root.mc_apmain2._currentframe == 5) { _root.mc_apmain2.play(); }}function homeClickreturn3() { if (_root.mc_apLink3._currentframe == 10) { _root.mc_apLink3.play(); } if (_root.mc_apmain3._currentframe == 5) { _root.mc_apmain3.play(); }}
thanx
5 Function Make It Just One
Happy New Year ::: 2004 ::::
hi guys...
if i have 5 function and i want to make them in just one.... the difference between them just in the name of the movie clip....
here Exp. for 3 :
ActionScript Code:
function homeClickreturn() { if (_root.mc_apLink1._currentframe == 10) { _root.mc_apLink1.play(); }}function homeClickreturn2() { if (_root.mc_apLink2._currentframe == 10) { _root.mc_apLink2.play(); } if (_root.mc_apmain2._currentframe == 5) { _root.mc_apmain2.play(); }}function homeClickreturn3() { if (_root.mc_apLink3._currentframe == 10) { _root.mc_apLink3.play(); } if (_root.mc_apmain3._currentframe == 5) { _root.mc_apmain3.play(); }}
thanx
Make This Into A Function?
As soon as you see some repeated code you think make-a-function. Well so did I
This is the working part
Code:
function show()
{
for (j=0; j<=userSquares.length-1; j++) {
//dynamicly attach mc's
test = userSquares[j];
_root.square_mc.attachMovie(test,"Square"+j,j);
trace("Square " +test);
_root.square_mc["Square"+j]._y = 51*j;
_root.square_mc["Square"+j]._width = 50;
_root.square_mc["Square"+j]._height = 50;
}
for (i=0; i<= userCircles.length-1; i++) {
_root.circle_mc.attachMovie(userCircles[i],"circle"+i,i);
test = userCircles[i];
//dynamicly attach mc's
//here all the layout _x, _y etc
_root.circle_mc["circle"+i]._y = 51*i;
_root.circle_mc["circle"+i]._width = 50;
_root.circle_mc["circle"+i]._height = 50;
}
}
and I want to rewrite it so I can use
Code:
function show()
{
displaySelectedArray(userSquares, square_mc, Square,50, 50);
displaySelectedArray(userCircles, circle_mc, circle,50, 50);
}
This is my attempt but I think I am not using/reading layoutMC the right way
Code:
function displaySelectedArray(whichArray, layoutMC, elementName, elementWidth, elementHeight)
{
//whichArray - holds the mc's to attach
//layoutMC - is an empty mc on stage which is the begin position
//for all the attachmovies.
//elementName - base name for all the attachMovies
//to- do x and y position
layoutMC = layoutMC._name;
for(i=0; i<whichArray.length;i++)
{
//dynamicly attach mc's
test = whichArray[i];
_root.layoutMC.attachMovie(test, elementName+i,i);
_root.layoutMC[elementName+i]._y = 51*j;
_root.layoutMC[elementName+i]._width = elementWidth;
_root.layoutMC[elementName+i]._height = elementHeight;
}
}
Any suggestions???
How To Make A Function 'mc.function()' ?
Hey.. I was hoping you could help me with this doubt. How do I make a prototype for a function like... mc.attachMovie() , or mc.nextframe(). Know what I mean ? the argument of the funcion is the mc.
How ?
How To Make Two Separated *.swf Work Together ?
Hello everyone....
Thank you for even taking the time to view my posting.
Is there anyway I can make the 1st *.swf to tell the 2nd *.swf what to do ? like go to....and play ?
I now have two *.swf in side the dreamwaver. One is a bar full with buttons on the top of the screen, the other one is just a movie (they are separated). I would like to know how to tell the movie go to and play when I press the button on the top ?
thank u very much
How Do You Use Textfields? And Make Them WORK
Mates, textfields are driving me crazy...
I'll try to explain what I've tried so far.
How it works:
My site consists of a main movieclip that loads other mcs while the user navigates. Each of these mcs has some text.
The headaches if I use dynamic text:
The font I'm using is quite common (SansSeriff) but there might be some special characters the user could miss. So I decided to use the embed fonts option but as the font is the same all the site through and that increased the file size quite a lot I tried using a shared library and a font for all the mcs instead. It just didn't work; flash used an unknown font for the bold upper case in the ALL the titles. No need to say that I never managed to get a full justification of the text.
Then I tried just static text. But suddenly some of my textfields just... dissappeared.
I don't know if this makes any sense. Maybe someone could help me and tell -step by step- what I could do. Maybe the best would be that you told me how you use textfields in flash...
A few days ago I though I could do quite well in AS and Flash, but at the moment I'm completely stuck.
Hope someone can help and heal this insanity that's getting my nerves on.
Thanks in advanced.
How Can I Make This Button Work?
hello i'm new using flash
i have a problem with a button and this is the problem:
in my movie i have 2 scenes but at the end of my first scene a set a script stopping everything but before that happends i activate a button with the action goto scene 2 frame 1, it works in the editing mode but once i try to publish it doesn't work in teh proyector,swf or whatever! the behavior of the button is not a button any more. i hope somebody can help me thanks!
|