Simple Question About Referencing Forms
I have what I hope is a simple question. Could someone please provide a primer on how to reference forms (and things contained in forms) in AS2? Specifically, I am having trouble referencing a form loaded into another form. Here is my form structure:
Application Form1 Form2
Loaded into Form1 is an swf containing another set of forms, with this structure:
NewApplication NewForm1 NewForm2
So, how do I reference NewForm1 from Application and vice versa?
Thanks.
-Brian
FlashKit > Flash Help > Flash ActionScript
Posted on: 11-19-2003, 02:12 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Referencing Buttons (simple)
I feel like chump at the moment... you guys are the only ones i can turn to for a quick answer.
All i need to know is how to referrence buttons and assign actions to them. I don't want to put the code directly on the button instance, but rather referrence the button from an actions layer.
Here is what I had.
HTML Code:
DRW.onRelease=function() { trace ("Hello")}
DRW is the instance name of the button.
Eek!
Simple Referencing Problem
Having a problem getting data to display in my dynamic text fields. have a movieclip and onRollOver it laods a movie clip to the stage which has the dynamic text fields in it. but at the moment it just displays: _level0.popout1.add1 However if i put the movieclip on the stage and give it the same instance name ("popout") it then displays the values and not the above. At the moment it has been assigned an identifier of "popout" in the library. Can anyone explain why?
Simple StartDrag() Referencing Problem?
Ok, this is simple stuff, I'm pretty sure I'm just being a complete nonce here but I just cant work it out....
Pretty simple, I have a function that's called from one point in the movie (I put a trace in this function so it is being called correctly). This function amongst other thing contains a startDrag() for a button. This button, when you click it, is what calls the function and also is the button that I want to make draggable.
The setup is like this:
_root -> MC1 -> MC2 -> button
So _root has in it MC1 which has in it MC2 which in turn has in it the button. the function code is on the _root timeline, and is called when you click the button and the button is also the subject of the startDrag() content of the function.
I use a with() command in the function to save a bit of code, in this case:
with(MC1.MC2){}
The startDrag() command in this with command this is then set like this:
button.startDrag(false, var, ious, para, meters);
Pretty straightforward huh? The problem is the button just wont drag! I cannot for the life of me work out why, its starting to drive me round the bend! I have also tried the old way of referencing:
startDrag("button", false, var, ious, para, meters); and also
startDrag(button, false, var, ious, para, meters);
I have also traced the boundary parameters to make sure they are right and even taken them away completely to no affect. My conclusion is I must be referencing the button incorrectly, but to me the code all looks good, can anyone else spot anything?
What Is The Simple Equivalent For Referencing The _root Timeline?
I've got a .swf (movie B) that gets loaded into a clip in my main movie(movie A). Movie B needs to control another clip within movie A.
In AS2, i would simply start off with a _global var on the main _root timeline, like this:
_global.home=this;
then, later in my seconday movie (movie B) i would reference that timeline simply like: home.myClip.gotoAndStop("whatever");
What is the simple equivalent for referencing the _root timeline? I've tried _parent with no results.
I'm looking forward to utilizing classes more, but for now I've got timeline code (on a single frame at least), with aspirations of moving toward a 'class-based' development style.
thanks for any help!
Simple Problem - Referencing Objects By Variable Name
I have a simple function that dynamically creates text fields. My text field name is referenced by var thisTextField. Problem is, when i try to do things with my text field, actionscript shoots back an error as such:
There is no property with the name 'text'.
How am i supposed to apply properties to my object if my objects name is a variable?
Code:
function showProducts() {
var products:Number = 0;
var thisTextField:String = "product" + products + "_txt";
for (var itemID in _global.rtsData[_global.rtsPos]["products"]) {
this.createTextField(thisTextField,1,25,75,350,50);
trace(thisTextField);
thisTextField.autoSize = true;
product+products+_txt.text = _global.rtsData[_global.rtsPos]["products"][itemID]["products_name"];
products++;
}
_root.products_mc.gotoAndPlay("fadeIn");
}
Simple Forms
Can anyone help? I am working my way through the simple form tutorial, and I am stuck on the section where I attach script to the send button. The last two commands, "End if" and "End on" dont appear to there to select. I am using Flash 5, has this changed in the update from 4 to 5?
If anyone could help it would be fantastic.
Thanks
Alan
Simple Forms
I am only a beginner so i dont know, but can i make a form in flash that users can type into and then send it directly to my email account with out the use of C.G.I
Obviously components would come into it somewhere.
This Should Be A Simple On (more On Forms...)
Flash MX 2004 Professional (latest update applied)
I'm sure all you gurus out there are absolutely sick of reading flash form questions ... probably just as sick as I am of reading tutorials that I just can't get to work.
I am redesigning my new site completely in Flash (with an html-based sidekick site for dialup users). On the html site, I can easily get the small form to work - not so much luck in flash. I need to be able to pass form data (just a text input and combo box along with 2 static 'variables') to a php script and I simply cannot get it to work. This is a simple domain registration form. Nothing fancy, no validation ... The required elements (per html) are:
<form method="post" action="https://domain.com/billing/order/orderwiz.php">
// -------my two static entries that need to be passed------- \
<input type="hidden" name="v" value="1">
<input type="hidden" name="submit_domain" value="register">
// -------domain name from user input (text input)------- \
<input type="text" name="domain" value="">
// -------my combo box options------- \
<select name="tld_extension">
<option value="com">.com</option>
<option value="net">.net</option>
<option value="org">.org</option>
<option value="info">.info</option>
<option value="biz">.biz</option>
<option value="us">.us</option>
</select>
<input type="submit" name="submit" value="Go!">
</form>
I would like this to send the user and his variables to the php page. I would post what I have tried, but I would like to see a fresh start on this instead of trying to fix my poorly written code. Find the format that I have been working with below (all previous AS stripped out) (please keep reponses simple and stupid - kinda the way I feel right now ) Your help is greatly appreciated
Download layout fla here.
Simple Problem - Referencing Object Array Properties
Sure this is dead straightforward. My flash creates a bunch of objects with x and y properties. These all get pushed into an array and then my .NET aspx page gets the array as an argument. This seems to be an ArrayList (although the documentation seemed to say it would be a HashTable) of ASObjects. How do I then refereence the x and y properties of the ASObject - is this what is now referred to as a Key?
Simple Forms To Email
I am trying to create a simple web page with 2 input text fields at the bottom for users to input a company name and donation amount. I have these created in flash mx2004 version 7 but I don't know what actions to attach to them to have the information users input transferred to an email address. Any help would be appreciated.
Shannon
Looking For A Tutorial On Simple Forms
I am looking for a tutorial that will introduce me to setting up a simple feedback form in Flash MX and that hopefully covers sending the gathered user input to FormMail.
The tutorials I have seen so far, seem to concentrate on radio buttons, combo boxes, check boxes, styling, etc., as opposed to text boxes and textareas and how to send results somewhere.
Any suggestions?
A Few Questions In Regards To Forms: Simple
Stop animation repeating:
-if i want to fade my form using an alpha of 0% starting out then 10 frames later fade to 100% alpha, then how do i make it so it doesnt repeat itself? instead do it once as the form is loaded.
text component trouble:
i have text fields im using as input text fields. a tutorial that i learned from told me to start out by making a button and place the text in the up frame. this way when i drag the text button onto the frame i can fade it and do other things as its a symbol..
Problem
doing this i end up with TWO instance names, one on the button symbol and one when i drag it onto the scene. which one am i using? also in the code am i making my own variable or am i using the one i specified in the button scene
i put my questions down below
PHP Code:
function onSubmit()
{
// Initialize form variables:
formData = new LoadVars();
//ok so is this a variable i make up now or am i using the one i gave to the text box button?
formData.name = "";
// Get textbox info:
//is txtname the instance name of the textbox? if so which instance name? the one on the scene or the button
formData.name = txtname.getValue();
last question:
do i put the code in the frame/scene rather than the actualy submit button?
Flash Forms And Simple If Else Condition
I created a Flash form for users to fill out. When the form is submitted they leave the movie. I want to return users back to a specific frame in the flash movie after the form has been submitted.
I have control over the redirect URL after the form submits and I can dynamically provide variables in an ASP file.
The variables print properly in a dynamic text box so I know the values are coming across.
I tried to solve my problem by pulling variables from an ASP file and then using those values to take the user to the thank you page or the primary content. If var0 = 1 then take them to the thank you page, else take them back to the primary content. The way I am doing it below doesn't work...
Any suggestions?
loadVariablesNum ("variables.asp", 0);
if (var0 = 1) {
gotoAndPlay (10);
stop ();
} else {
gotoAndPlay (5);
stop ();
}
Flash Forms And Simple If Else Condition
I created a Flash form for users to fill out. When the form is submitted they leave the movie. I want to return users back to a specific frame in the flash movie after the form has been submitted.
I have control over the redirect URL after the form submits and I can dynamically provide variables in an ASP file.
The variables print properly in a dynamic text box so I know the values are coming across.
I tried to solve my problem by pulling variables from an ASP file and then using those values to take the user to the thank you page or the primary content. If var0 = 1 then take them to the thank you page, else take them back to the primary content. The way I am doing it below doesn't work...
Any suggestions?
loadVariablesNum ("variables.asp", 0);
if (var0 = 1) {
gotoAndPlay (10);
stop ();
} else {
gotoAndPlay (5);
stop ();
}
Simple Forms Not Working On Flash 8?
Hello,
i'm trying to make a simple form, using the old but effective tutorials scattered around... I've developed forms successfuly in the past, but now the same procedures doesn't seem to work.. the strange thing is that the source files of the tutorials work, but my application doesn't; to be more precise, it works, but the mail i'm receiving back is blank, just the strings declared in the PHP file; tracing within flash, the loadVars object contains all the correct data, but somewhere in the road it gets lost. Does anybody knows the answer for this problem? I know almost nothing of PHP
Here's the code I've got (based upon a tutorial by CyanBlue)
ActionScript Code:
_global.sndMail = function(hasta) {
var pqte = new LoadVars();
for (i=1; i<=hasta; i++) {
var nTemp = tsp["c"+i].ct.text;
pqte[nTemp] = tsp["i"+i].text;
}
pqte.onLoad = function(ok) {
if (ok) {
trace("Email Sent!!!");
} else {
trace("Problem sending an Email!!!");
}
};
pqte.sendAndLoad("form.php", pqte, "POST");
};
tracing unescape(pqte) yields this
PHP Code:
");
}
}
else
{
echo("This script runs only in Flash!!!");
}
?>
=&");
}
else
{
echo("=&result=2&<?php
if ($_POST)
{
$mailTo = "berrios@instrumental.cl";
$mailSubject = "[Contact] Website Contact from - (" . $_POST['NOMBRE'] . ")";
$Header = "MIME-Version: 1.0
";
$Header .= "Content-type: text/html; charset=iso-8859-1
";
$Header .= "From: " . $_POST['E-MAIL'] . "
";
$output = "<BR>";
$output .= "De : " . $_POST['NOMBRE'] . "<BR><BR>";
$output .= "e-mail : " . $_POST['E-MAIL'] . "<BR><BR>";
$output .= "comentario : " . $_POST['comentario'] . "<BR><BR>";
$output = nl2br($output);
if (e-mail($mailTo, $mailSubject, stripslashes($output), $Header))
{
echo("&onLoad=[type Function]&COMENTARIO=HERE I WROTE MY COMMENT&EMPRESA=HERE I WROTE MY COMPANY NAME&E-MAIL=HERE I WROTE MY E-MAIL&NOMBRE=HERE I WROTE MY NAME
Email Sent!!!
The text is sent with all caps, so i tried to change some variables to all caps and others not for testing purposes... i didn't add the "company" field because the example php file had only three fields, wanted them to work before changing more things around...
Thanks in advance,
Sir Patroclo
Anyone Had Experience With Forms And Flash? Simple Problem I Think
hello friends,
i've created a flash form that im using to send four variables to a php script.. I am having some trouble sending the
variables to the script.. In fact, i cant get it to work at all.
I have created the file
http://members.optushome.com.au/panus/flash.swf
The drop down buttons are set in the movie mode which i think is correct, along with the submit button.
I looked up what action script I should use but found many different ones. I tested a couple of them out but they don't
seem to submit anything at all, the submit button isn't functioning. It's like the submit button isnt attaching itself
to the values of the drop down buttons, and then not submitting..
I tried using
On (Release)
Load Variables ("mailto:form.php", 1, vars=POST)
End On
I'm pretty new to flash and was hoping for a little help.
the flash file is located here if you want to have a look
http://members.optushome.com.au/panus/flash.fla
regards
-n
Flash "forms" Behavior - Simple Main Frame Sim
I have a Flash object that is emulating a main frame application. I have the user tab to a particular spot, enter a value, and if the value is correct, I send the user to another frame in the object. If the value is not correct, the user is alerted and directed to correct the entered value.
The actionscript involved uses text objects which listen for values; once anything at all is entered in the target text area, the last of 4, the focus shifts to a hidden button. The button is supposed to respond to the user striking ENTER by testing the value of the text area and responding accordingly.
The problem: although the button receives the focus, it does not respond to the ENTER key. The code for the button and the text area are below (the text and the button are in the same layer).
Button code:
PHP Code:
on (release, keyPress "<Enter>") {
// assign text entered to variable for testing
newPathCEc = text4_CE26c_var;
if (newPathCEc == "S") {
//jump to next frame, frame 10
gotoAndStop(10);
} else {
loadMovieNum("../images/feedback_incorrect_daace26c.swf", 4);
}
}
Code for textbox:
PHP Code:
stop();
//set focus on first text area
Selection.setFocus(text1_CE26c);
inputButton_CE26c._focusrect = false;
unloadMovieNum(4);
inputButton_CE26c._focusrect = false;
//prevent text in all but the last test region, allowing all to receive the tabbed cursor
text1_CE26c.restrict = " ^A-Z 0-9";
text2_CE26c.restrict = " ^A-Z 0-9";
text3_CE26c.restrict = " ^A-Z 0-9";
text4_CE26c.restrict = " A-Z";
text1_CE26c.tabIndex = 1;
text2_CE26c.tabIndex = 2;
text3_CE26c.tabIndex = 3;
text4_CE26c.tabIndex = 4;
//code to direct tabbing action so user moves through subsequent text areas
increment = 0;
keyListener1_CE26c = new Object();
Key.addListener(keyListener1_CE26c);
keyListener1_CE26c.onKeyDown = function() {
a = Key.getCode();
if (a == 40 || a == 9) {
next = increment++;
Selection.setFocus("text"+next+"_CE26c");
//Selection.removeListener(textboxListener);
}
};
// send focus to hidden button if the user types anything into the last text region
textListener4_CE26c = new Object();
text4_CE26c.addListener(textListener4_CE26c);
textListener4_CE26c.onChanged = function() {
if (text4_CE26c.length == 1) {
Selection.setFocus(inputButton_CE26c);
//trace("I've changed");
Selection.removeListener(textListener4_CE26c);
}
};
Converting Html Forms To Flash Forms?
i'm in the middle of creating a website for a record company. i've been doing it all in flash, so when they asked me to set up a newsletter facility, i decided it would be in flash. here's my problem:
the host i'm using has a newsletter add/remove facility in html. i've tried converting this into flash but it just wont work! the html form code provided by the hoist (which does work) is below:
<form action='http://cp.cyberstation.co.uk/list.cgi' method='post'>
<input type='hidden' name='list' value='Newsletter'/>
<input type='hidden' name='redirect-success' value='http://www.mickhayglaziers.co.uk/complete.html'/>
<b>Our Mailing List</b><br/>
<input type='text' name='email'/><br/>
<input class='radio' type='radio' name='action' value='add' checked='checked'/>Subscribe
<input class='radio' type='radio' name='action' value='delete'/>Unsubscribe<br/>
<input type='submit' value='Do it Now!'/>
</form>
The actionscript i used on the submit button when converted is:
on (release) {
list="Newsletter";
action="add";
loadVariablesNum ("http://cp.cyberstation.co.uk/list.cgi", "0", "Post");
}
The button is also, along with the list and action variables, on the main timeline!
can anyone offer any insight to where i'm going wrong?
Email Forms, Feedback Forms
I have posted the same topic on the other section but i thought perhaps this one would be more appropiate?
I need help with creating a feedback forms (name, phone nubmer, email, comments etc) in a flash site.
I have d/n a CGI script that comes with the tutorial in Flash Kit. and I also found a PHP scripts that i was told it should do the same thing.
I am new to BOTH, CGI or PHP whatever,
After i read the CGI mail form tutorial , it seems like i need to link the button to cgi-bin/whatever.cgi right? How about PHP? Questions is DO i just paste the PHP code in the action windows of flash MX or place the code in a html page that creates a seperate window?
What is easier for newbees like me and is there any easier approprach?
__________________
*!* I really need some help *!*
Forms, Nested Forms, And Masks?
Is there a way to provide a mask that applies to nested slides and forms? I have a structure that looks like this:
Form1
Slide1
SubSlide1
SubSlide2
SubSlide3
SubSlide4
SubSlide5
SubForm1
SubForm2
The app starts and shows Slide1 containing a background provided by Form1 then based on button rollovers the sub slides show with a nice fade transition. This all works GREAT.
When the button is clicked the selected SubForm1 or SubForm2 screens (which contain separate swf files) is displayed with a left to right “fly in” transition while the Slide1 is hidden with a right to left “fly out” transition. Now again this works great except for the fact that I need a mask so that the user does not see the SubForms flying from outside the bounds of Form1.
I have tried applying masks to ALL forms and subforms with no success (including the masks to forms in the external swf files on the SubForms.) Is there a way to make this work or do I have to use a loader component to make the mask work the way I want?
Thanks,
R. Sparrow
Forms And Email Forms
Does anyone know of any good tutorials on how to make Mail forms.
I want to Build a form with custom fields and i dont know where to start.
Referencing DLL's
Is there a way to reference a DLL from actionscript? If so, can you use ADO to connect to a MSSQL Server DB through actionscript? If anyone has any sample code please post it in a reply.
Thanks
Mo Referencing
Hi, I have a series of movie clips on the main stage called, t1,t2,t3 etc.
Each has the stop action on it's first frame.. so I want the following code to make a random one play..
i = random(15);
eval("_root.t"+i+".gotoAndPlay(2)");
I know the second line is not working but can't work out why..it doesn't need another part to the equation or anything does it?
Thanks
Referencing
Hi,
I have a scrollpane (from the component menu) which is supposed to scroll through a movie clip (called roller_icons) that consists of several icons. the scrollpane is in a movie called build. This movie has several frames: general, wind and solar. I have put a stop() in the first frame of general, which is frame 1. I would like the movie to play the wind frame when a specific button is pressed. So, in that button, I put:
on (rollOver) {
this.gotoAndStop("over");
}
on (rollOut) {
this.gotoAndStop("up");
}
on (press) {
this.gotoAndStop("down");
_parent._parent.gotoAndStop("wind");
}
I am not sure why i am not able to get into the wind frame at all. What am I doing wrong? PLS HELP!
Referencing Different .txt's
So-- I have(thanks to the tutorials) a new dynamic text box. However, the Flash site I'm making is going to have to refer to several different texts in order to be functional. For example, I have a box with a .txt in it. The user clicks on a section and the textbox(which can go to a different scene or whatever, doesn't matter) switches to the other .txt file. So... I gave a shot at changing the "news.txt" expression in the script to a variable. An example with 'gist' of the code:
on event(load){
loadVariables(contentFile);
And then I'd put the code in the corresponding buttons:
on MouseEvent...
gotoAndStop("other scene");
contentFile=("otherpage.txt")
First problem I discovered was that the instances don't like me changing their actions independently. When I changed one, the others would apply the same changes. I'm pretty sure I'm not editing the symbol. The other problem is that I'm not sure the link button is the best place to initialize a variable. I may have to do it in the preloader. Of course, I'm pulling all these theories out of my ass; you guys would know the logic behind it better than I would. I'm using Flash 5, by the way.
MC Not Referencing
Code:
L1_goto = function (currentSection) {
trace(currentSection);
_root.mainNav.currentSection.gotoAndPlay("Hover");
};
L1_goto("L1_1");
I made a function which takes "currentSection" as the argument.
The gotoAndPlay part doesn't work. The "L1_1" clip is not playing.
Var Referencing
Say, on the stage, I have code that creates thumbnails from a loop, which takes a container clip from the library and then that preloads an image. I'm thinking of having those containers each add the the stage it's bytesTotal and bytesLoaded so that I know the percent of all the total thumbnails loaded.
So I was thinking I would reference a var on the stage from the container. So when I create the container I would say:
container.refVar=thisVar;
so then in the container I could just say refVar+=image.bytesLoaded and then that would change thisVar on the stage, so that all thumbnails could add to it.
If that makes sense, does anyone know how to do that?
[CS3] Referencing A MC
I have a bunch of MCs on the stage (not placed dynamically) with names like "branch123_mc", "branch395_mc", "branch412_mc", etc. Each follows the format:
branch+some 3-digit number+_mc
Those three digit numbers are all held as sub-sections called "branch" within an array called "totals"...
Using AS2.0, I want to go through each item in the totals array, and grab that item's 3-digit branch number, then I want to reference each MC with a "onRollOver" function. Here's what I have that isn't working (but should give you an idea of what I'm trying to do):
Code:
for (var i:Number = 0; i < totals.length; i++) {
var thisClip:MovieClip = ("branch" + totals[i].branch + "_mc");
thisClip.onRollOver = function() {
doSomething();
}
}
That syntax isn't working at all. "totals[i].branch" traces out acurrate numbers, so that's not the problem. Can anyone help?...
Referencing A MC...
I have a bunch of MCs on the stage (not placed dynamically) with names like "branch123_mc", "branch395_mc", "branch412_mc", etc. Each follows the format:
branch+some 3-digit number+_mc
Those three digit numbers are all held as sub-sections called "branch" within an array called "totals"...
Using AS2.0, I want to go through each item in the totals array, and grab that item's 3-digit branch number, then I want to reference each MC with a "onRollOver" function. The code below is what I have that isn't working (but should give you an idea of what I'm trying to do):
for (var j:Number = 0; j < totals.length; j++) {
var thisClip:MovieClip = ("branch" + totals[j].branch + "_mc");
thisClip.onRollOver = function() {
doSomething();
}
}
That syntax isn't working at all. "totals[j].branch" traces out accurate numbers, so that's not the problem. Can anyone help?...
Referencing An .mc
HI
i have a main timeline with an .mc. named ztop.mc
on this main timeline i have another .mc named mainContent_mc inside which i have placed some actions.
im not sure how to correctly call them. im trying to make each .mc interact or animate with eachother but i cant even corectly measure or work with them (the ztop.mc appears at one position on the stage and correctly alligned, but when i test it, the same ztop.mc is maybe 30-80px off position.
i have included the .fla so you might see, but really maybe need tute to show me the way, if only i knew what the name of the tute might be ....so does anyone know what it is i need to understand cos im up against it now.
-dj
(for anyone who checks the .fla : i want to animate the ztop / zbot .mcs across the mainContent_mc, but at the moment cant do it)
[] Referencing
I'm doing some work which involves square grids.
I've used sprites to display the individual squares.
Now my question is how can i refer to the sprites like we used to refer to movieclips in AS2 like following?
this['block_'+j]For time beging, i'm just pushing all the square boxed into an array to refer them by array index.
Referencing
Hi There,
I have odd problem here
I´m not able to reference property "prop" in class Level.
FLA file:
Code:
var mainLogic:Level = new Level();
Level.as:
Code:
package {
import flash.display.Sprite;
public class Level extends Sprite {
public var prop:int = 5;
public function Level():void {
var h:Tetris_Shape = new Tetris_Shape();
}
}
}
Tetris_Shape.as:
Code:
package {
import flash.display.MovieClip;
public class Tetris_Shape extends MovieClip {
public function Tetris_Shape():void {
trace(parent.prop);
}
}
}
I don´t know why, but it throws error 1119.....
1119: Access of possibly undefined property prop through a reference with static type flash.displayisplayObjectContainer.
Thank you for your responses.
Referencing A MC
Does actionscript only need the instance name to use as a reference, or does it also need the name of the movie clip in the library form which it originated?
EX.
MC Movie Clip1
Movie Instance name of MC
MC1 Movie Clip2
Movie Instance name of MC1
Does actionscript differentiate the differnce between the instance name Movie created from MC or MC1 ?
MC Referencing
Hi,
I want to load small thumbnails in my project, and each thumbnail presents a button. When I click on thumbnail bigger picture should show.
I put information about picture in each thumbnail movie clip but when I click on thumbnail flash can’t see that information?
Here is a small example what I’m trying to do. (mxTxt is information which I’m trying to catch).
Make three smal pictures named Picture1.jpg, Picture2.jpg, Picture3.jpg.
Please help.
Cheers
Code:
var caption:Array = new Array();
var path:Array = new Array();
caption[0] = "One";
caption[1] = "Two";
caption[2] = "Three";
path[0] = "Picture1.jpg";
path[1] = "Picture2.jpg";
path[2] = "Picture3.jpg";
showThumbnails(caption, path);
function showThumbnails(caption:Array, path:Array):Void
{
var t:MovieClip = _root.createEmptyMovieClip("thumbnails_mc", 1);
var picNumber:Number = caption.length;
t._x = 10;
t._y = -10;
for (var i=0; i<picNumber; i++)
{
var thumbnail:MovieClip = t.createEmptyMovieClip("Thumbnail" + i, i);
thumbnail.myTxt = caption[i];
thumbnail._y = (i+1)*45;
loadThumbnail(thumbnail, path[i]);
}
}
function loadThumbnail(targetMC:MovieClip, path:String):Void
{
trace("Here he can se myTxt: " + targetMC.myTxt);
var mcLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
listener.onLoadInit = function(target:MovieClip):Void
{
target.onRelease = _onReleaseThumbnail;
}
mcLoader.addListener(listener);
mcLoader.loadClip(path, targetMC);
}
function _onReleaseThumbnail()
{
trace(this._name);
trace("OnRelease he doesn't see myTxt: " + this.myTxt);
}
OOP Referencing Question
To practice OOP in Flash 5, I would like to write a program that creates a large number of objects/movie clips, that do something simple, like follow the mouse around the screen.
I have written code to create an array that contains references to the objects I create. This works fine. The objects are created, they have variables that retain their state, and they have methods that I can call to act on the objects. For example calling the prototype function
"myArray[2].coords();" works fine.
But when I try to change the property of the movie clip, say the _x property, I have to reference the clip by name. In my code I am referencing the movie clip by name, ie "clip0", "clip1" and "clip2". But I need the object to be smart enough to reference itself so that I can tell it to move *ITSELF* around the screen.
in my code:
_root.clip0._x = this.xLoc;
but it needs to be something like
_root.this.clipID._x = this.xLoc;
or
_root.eval("this.clipID")._x = this.xLoc;
Any ideas? Am I going about this the wrong way? The manuals do not offer a lot of advice in this department.
----------------------
my object constructor
----------------------
function myObject (x, y, clipID) {
this.xLoc = x;
this.yLoc = y;
this.clipID = clipID;
_root.attachMovie("ball movie clip", clipID, 1);
_root.clip0._x = this.xLoc; // works but WRONG!
_root.clip0._y = this.yLoc; // works but not self referencing!
}
myObject.prototype.coords = function () {
trace (this.xLoc + " "+ this.yLoc + " " + this.clipID);
}
Referencing A Variable
Hi,
I'm having trouble referencing a variable. I have a movie clip containing another two movie clips and I need to set the width of one of the movie clips equal to the length of a text variable (to create a dynamic shadow) so I'm using this code:
onClipEvent (load) {
this._xscale=../text.length*50;
}
but this doesn't work, how do I move up the heirachy one movie clip before drilling down into it?
Thanks
Referencing Functions
how do i reference a function from within a movie?
i have a function on my main timeline and I'd like for it to be global, but I can't call it from within any movies successfully. If i copy the function within the movie and call it, it works fine.
Thanks.
Referencing Mc Within A Button
can you reference a ovie clip within a button
if i name an instance of a movie clip to "mymovie" and place it in root- I can control is via _root.mymovie etc
however ig that mvoie is not in root but in the first frame of a button (and you dont seem to be able to name an instance of a button) then how can you referende the movie?
Thanks in advance
A Pem Referencing A Variable
The following line in my code works just fine:
k = _root.answer4.substr(1,4)
The problem is, the number "4" is a variable that is generated using the following code:
_parent._name.substr(1, 1)
I can't find a way to use this code in the "k =" line so that it works. I have tried:
k = eval("_root.answer" + _parent._name.substr(1, 1) + ".substr(1,4)")
but of course, "eval" doesn't work the same way in Actionscript as it does in Javascript.
Anybody know how to make this work?
MC Referencing W/ DuplicateMovieClip
When I address dynamic duplicate movies, this is how I do it using Flash5 notation:
_root.myclip["mc"+x]._y=ypos;
Obviously, I'm referencing from the root and the movieclip where the duplicating takes place. What I need to know is, how do you reference the clip on the same timeline inside the mc where the target mc is located? I tried this:
["mc"+x]._y=ypos;
but that doesn't seem to work. What is the correct way to address this clip? In Flash4, I've seen examples that use this:
setProperty(eval("mc"), _y, ypos);
but I began learning Flash in v5, so I don't want to start doing it this way (or is this the only way?)
Any help would be great!
Chris
Variable Referencing?
ok i have numerous mc and in each mc it has the same variable so my question is how do i change that variable in each mc the variable is "k" so how would i label that in other words how would i specify in each change in each variable-- and in each mc i want to change the variable to be different in every one
any help is greatly appreciated
***REFERENCING ARRAYS***
Once again I'm trying to apply C++ practices to ActionScript. I'm trying to create a variable that references an array. For example:
(root)
myArray = new Array("a","b","c");
(inside a movieClip placed on the root)
refernceToMyArray = _root.myArray;
The reason I'm trying to do this is because I have a function on the root that requires an Array. However, the function is being called by a movieClip on the root. One of the properties (set as a variable in the first frame) is parentArray. The variable refers to the myArray as shown above. In C++ referncing an array is quite simple using the & when creating the variable. This tells the compiler that the information stored in this variable is the address to a memory block not a value. And this is what I am ultimately trying to achive.
Referencing A Button Name
Question from a bewildered newbie--
How do you retrieve at run-time the name of the button instance that's currently being pressed by the user? I originally thought about using "this._name" in the code associated with the release event handler for the said button. But when I traced this._name, it always returned an empty string. According to the Flash help documentation, "inside an on event handler action attached to a button, 'this' refers to the Timeline that contains the button," rather than the button itself. So how do you refer to the button itself, if not using "this"?
Referencing Movieclip
I need to set the width and hieght of a movie clip "pic".
I want "pic"
width = 340
height =170
Questions
1) What are my options to do this.
2) "pic" displays dynamically loaded .jpgs from a .txt file. How could I make the image enlarge to the following sizes when "pic" is pressed?
width = 460
height = 360
Referencing Problem
I've got a bit of a referencing problem, _root.etc.etc thingy.
I've got my main swf, which has a preloader for loading external swf's. in the main swf i have a 'cover' mc with a 'loading' mc in it. When you select an item from the menu it loads an external swf, the first frame in the external swf tells _root.cover.loading to go to the frame determined by the percentage loaded.
Now that all works fine, however, in the external swf's, i may have a button to load another swf, in the 1st frame of this 2nd external swf everything is the same.
But the preloader bit doesn't work, it doesn't show how much has loaded, so obviously it's a problem referencing _root.cover.loading.
I've been trying everything for the last day or so and got nowhere.
http://roycegraciesheffield.com/help.zip
that contains the main.swf, the 1st external swf loaded, and then the 2nd external swf.
Hopefully you can follow it and know what's going on.
Look in the actions for the button over the Gallery menu option in the main swf, then the actions in the button over the red link in the gallery.swf file to see how it's working.
Thanks for any help!
Robsco!
Referencing In MX2004
heya guys, hope someone can help me here, my jobs on the line!
I have a movie clip that needs to reference the main timeline to then jump to a specific scene.
what is the basic code??
i have been using _root.gotoAndPlay ("sceneName", 1) as it just doesnt work
please please can someone help me???
big thanks for anyone who can :>
ross!
Scene Referencing
Hi All,
I have a movie with 2 scenes. On the first (Menu) is a button with action to open the second scene (MovieScreen), then I want it to load a flv file into the movie component (myPlayer). At the momement when clicking the button the scenond scene appears but the movie does notload into the component. The component is not the problem as if the line to load it is on the same page the movie loads and plays.
This Works on a single scene
on (release) {
myPlayer.loadVideo("../movies/womenatwar.flv");
}
This does not work when I put the movie component on a separate screen
on (release) {
gotoAndStop("MovieScreen",1);
MovieScreen.myPlayer.loadVideo("../movies/womenatwar.flv");
}
Its probably something stupid I have done as I am just starting out in Flash. Hope You can help
Array Referencing
please help
I'm playing around with buttons moving an object on the stage, I can get this working fine but I want to use an array to indicate the amount of pixles that the object moves.
this is the coding on the stage for the first frame:
MyPos = new Array("10", "20", "30", "40", "50", "60", "70", "80", "90", "110", "120");
var current:Number = 0;
the variable "current" I'm using as a counter to indicate what index of the array is to be requested.
here is the code on the button:
on (release) {
trace(current)
if (current < MyPos.length) {
trace(MyPos[current]);
sygArrow._x += MyPos[current];
current++;
trace(current);
}
}
I can get it working if I use the number '10' instead of 'MyPos[current];'
good luck and thank you for taking a look.
post a message of send as email to intract_6@hotmail.com
MC Referencing Problems :(
Hi - i have to provide this banner to a site - but they only accept relative MC referencing.
I have an empty mc on the main timeline (that will have amovie loaded into it) that i want to reference further down a nested set of MCs.
my problem is that when I come to target the mc within the actions panel it cant see it in relative mode -only absolute! :-(
why is this?! i can only see it when from the main timeline
thanks for your help
|