What's Wrong With My Code?
I am using Flash MX, and I am trying to put the code below into a text box.
onClipEvent (load) { daTextBox = "<P ALIGN="LEFT"><FONT FACE="Arial Baltic" SIZE="5" COLOR="#000000">These terms and conditions, together with our Privacy Policy govern your use of synapses.ca ("Synapses". By using these web sites (collectively called the "Service", you consent and agree to these terms and conditions.</FONT></P><P></P>"<P ALIGN="LEFT"><FONT FACE="Arial Baltic" SIZE="5" COLOR="#000000">Copyright</FONT></P><P ALIGN="LEFT"><FONT FACE="Arial Baltic" SIZE="5" COLOR="#000000"> Synapses Limited, Synapses.ca, "Synapses" the name and its Services are protected by Copyright as a collective work and/or compilation. Information, compilations of information, graphics and other material ("Content" of the Service is copyright © 2004 by Synapses Limited. Unless otherwise explicitly stated by Synapses, you may copy the Content only for your own personal use, provided that you maintain all copyrights and other notices that are contained in the Content, but you may not otherwise download or store Content. Except as allowed by copyright laws, no copying, storage, publication, or redistribution of any Content is permitted without the express written permission of Synapses.</FONT></P><P></P><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="6" COLOR="#0000CC"><B>Claims of Copyright Infringement</B></FONT><P ALIGN="LEFT"></P><P ALIGN="LEFT"><FONT FACE="Arial Baltic" SIZE="5" COLOR="#000000">If you believe that this site contains material which infringes upon your copyrighted work, please submit the following information to our designated copyright agent: <br><ul><li>A physical or electronic signature of the person authorized to act on behalf of the copyright owner; </li><li>A description of the copyrighted work that you claim has been infringed upon;</li><li>A description of the location on this site of the work that you claim infringes the copyrighted work; <br>Your contact information, including address, telephone number and e-mail address; </li><li>A statement that you have a good faith belief that the use of the alleged infringing material is not authorized by the copyright owner, its agent or the law; and </li><li>A statement by you, made under penalty of perjury, that the information submitted above is accurate and that you are either the copyright owner or authorized to act on the copyright owner's behalf. </li></ul><P></P><P ALIGN="LEFT"><FONT FACE="Arial Baltic" SIZE="5" COLOR="#000000">Submit the information above to the following designated copyright agent:</FONT></P><P></P>";
scrolling = 0; frameCounter = 1; speedFactor = 20; } onClipEvent (enterFrame) { if (frameCounter%speedFactor == 0) { if (scrolling == "up" && daTextBox.scroll>1) { daTextBox.scroll--; } else if (scrolling == "down" && daTextBox.scroll<daTextBox.maxscroll) { daTextBox.scroll++; } frameCounter = 0; } frameCounter++; }
where in blue fonts are not working, but I don't know why??! can someone please help?!
Thanks a lot! ..howtodo
FlashKit > Flash Help > Flash ActionScript
Posted on: 01-19-2006, 08:04 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
What Is Wrong With This Code (NaN?)
I am using this code to animate an icon based on the amount of movie downloaded:
tellTarget ("icon") {
frameVar = Math.round((bytesLoaded/bytesTotal)*100);
Trace(frameVar);
gotoAndPlay (frameVar);
The trace command brings back NaN when I use the (frameVar = Math.round((bytesLoaded/bytesTotal)*100) in tell target.
What is this?
What's Wrong With This Code?
This is a preloader I've used time and time again when producing games in Flash 5. This game is made in Flash MX but exports and only uses Flash 5 action scripting.
The first time you go to the URL, when the movie is 100% loaded the movie goes blank. The next time you load it, it successfully goes to the game on the second frame. You can see what I mean at:
http://www.flasharcadia.com/chariot
Here's my code, placed on top of an mc on the first frame of a 2 frame movie:
onClipEvent (enterFrame) {
totalKB = _parent.getBytesTotal()/1024;
loadedKB = _parent.getBytesLoaded()/1024;
exactpercent = (loadedKB/totalKB)*100;
percent = Math.ceil (exactpercent);
perc = percent+"% loaded";
bar._xscale = percent;
if (percent == 100) {
_parent.gotoAndStop ("gameStart");
}
}
Cheers
PS: I'm on a Mac
What Wrong With This Code
here is the code the button 1
on (press, release) {
if (Number(test) == 1) {
test = 0;
} else {
test = 1;
}
}
the MC named test
code
onClipEvent (load) {
if (Number(_root.test) == 1) {
gotoAndPlay("go");
}
}
onClipEvent (enterFrame) {
if (Number(_root.test) == 1) {
gotoAndPlay ("loopframe1");
}
}
What's Wrong With This Code?
When I enter this:
onClipEvent (load){
daTextBox = ".....text.....";
scrolling = 0;
frameCounter = 1;
speedFactor = 3;
}
onClipEvent (enterFrame){
if( frameCounter % speedFactor == 0){
if( scrolling == "up" && daTextBox.scroll > 1){
daTextBox.scroll--;
}
else if( scrolling == "down" && daTextBox.scroll < daTextBox.maxscroll){
daTextBox.scroll++;
}
frameCounter = 0;
}
frameCounter++;
}
What's Wrong With My Code?
Ok. I'm developing a product review section on my site, and ive got a listbox for the products, a dynamic text field for the review, and two pushbuttons (one supposedly opens the product site and the other downloads it.) Right now i am trying to give items in the listbox a url so when u click the "product site" button it opens up the site.
This is the code for the PushButton:
on (release) {
site = list.getSelectedItem().Object;
address = "http://www."+site+".com"
getURL(address)}
For a test I used this code on one of my list entries:
list.addItem("Sample Review", new Object("yahoo"));
Whenever I press the button, it goes to http://www..com and completely ignores the site code.I am a newbie at coding in actionscript and am frustrated, please help.
What's Wrong With This Code?
Hi...i cant subtract the score....anyone?
onClipEvent (enterFrame) {
setProperty ("", _rotation, _rotation + 2);
if (_root.sprayer.launcher.hittest(_root.cursor._x, _root.cursor._y, true)) {
setProperty ("_root.cursor", _x, 130);
setProperty ("_root.cursor", _y, 310);
tellTarget ("_root") {
score = score - 10;
}
}
}
it just makes teh score go "010", "01010" etc.
thanks in advance, sean.
Is There Something Wrong With This Code?
loadedBytes = _root.getBytesLoaded();
totalBytes = _root.getBytesTotal();
if (loadedBytes >=totalBytes) {
gotoAndPlay("home");
}else{
gotoAndPlay("preloader");
}
It goes to the movie without being fully preloaded.
Am I Using The Wrong Code?
I am having problems with a image scroller i've adapted. It worked ok on it's own on the main timeline, but as soon as I put it within a movie it doesn't run properly. It could be something quite simple that i'm missing.
I'd appreciate it if somebody could take a look.
What's Wrong With This Code?
Code:
for (i=0; i<numOptions-1; i++) {
duplicateMovieClip("_level0.newmenu.buttonMC", "subMenu"+i, i);
menuna = sub[i].attributes.title;
set("_level0.newmenu.subMenu"+i+".menuname", menuna);
subMenu[i].onRollOver = function() {
_level0.isay = sub[i].attributes.over;
setProperty("_level0.imcbaloon", _visible, true);
};
_level0.newmenu[subMenu[i]].onRollOut = function() {
_level0.isay = "";
setProperty("_level0.imcbaloon", _visible, false);
};
_level0.newmenu[subMenu[i]].onPress = function() {
actionscript(sub[i].attributes.click);
};
setProperty("_level0.newmenu.subMenu"+i, _y, optiony);
setProperty("_level0.newmenu.subMenu"+i, _x, optionx);
optiony = optiony+18;
}
the on funcions do not work. everything else seems fine.
What's Wrong With This Code? ---->
Hey guys.
I have my root.swf. I have another clip, pb.swf, that I load into level 2 from the root. I have a button in the root:
Code:
on (release) {
tellTarget ("level_2") {
play();
}
}
Can anyone tell me why this isn't working for me?
Thanks....
Nevermind....got it
Something Wrong With This Code
Hi Guys, Happy New Year!
Need your guys help...there must be something wrong with this code, coz it doesnot work
function onClick(btn) {
calcMonthlyStar = plotMonthly_box.getValue();
checkError();
if (btn == submit_btn) {
if (calcMonthlyStar == true) {
if (gotError == 1) {
gotoAndStop(2);
} else {
gotoAndPlay(3);
}
} else if (calcMonthlyStar == false) {
if (gotError == 1) {
gotoAndStop(2);
} else {
gotoAndPlay("display");
}
} else {
}
} else if (btn == reCalculate_btn) {
initValues();
gotoAndStop("input");
}
}
// check for error
function checkError() {
period = period_box.getSelectedItem().data;
selectedPeriod = period_box.getSelectedIndex();
degree = direction_box.getSelectedItem().data;
selectedDirection = direction_box.getSelectedIndex();
if (period == 0) {
gotError = "1";
}
if (degree == 0) {
gotError = "1";
}
}
period_box and direction_box are ListBox component. plotMonthly_box are CheckBox componet.
Thanks, Niisa
What's Wrong With My Code?
Hi.
I have an XML presentation which needs to work with a menu. Thanks to Jack Frost I'm almost there, but I've hit (another) wall! Here is an overview of my code...
This code is attached to a button, within a movie clip called 'menu':
on (release) {
var /:id = 1;
_root.gotoSlide(/:id);
}
This code is in the root, the function is called by the button above:
function gotoSlide(id) {
for (var a = 0; a<complianceXML.firstChild.childNodes[1].childNodes.length; a++) {
if (complianceXML.firstChild.childNodes[1].childNodes[a].attributes["id"] == id) {
currentTemplate = complianceXML.firstChild.childNodes[1].childNodes[a].childNodes;
trace(complianceXML.firstChild.childNodes[1].childNodes[a].childNodes);
showSlide(currentTemplate);
}
}
}
This is also in the root, called by the function above:
function showSlide(templateNode) {
type = templateNode.attributes.type;
switch (type) {
case "0" :
hideTemplates();
showTemplate1(templateNode);
break;
case "1" :
hideTemplates();
showTemplate2(templateNode);
break;
case "2" :
hideTemplates();
showTemplate3(templateNode);
break;
}
}
Now, when I click my button, the template that I wish to display (referenced by 'id') traces well in the output window, but doesn't display in the player. I have used a similar, allbeit more simpler version of the 'gotoSlide' function called 'gotoNextSlide' which works fine, by changing the variable 'currentTempate' to 'currentTemplate.nextSibling' - I'm sure you Flash genious's out there will know in miliseconds the answer ;-)
Cheers, gryllsie
What Is Wrong With This Code?
it is one frame code and it should preload some swf, but it doesn't
why?? it just go to label "igra" what to do?
stop();
for (i=0;i<_parent.brojKarti;i+=2)
{
_parent.punjenje.b=i;
this.createEmptyMovieClip('konjT'+i,i);
this['konjT'+i].loadMovie('znakovi\'+_parent.poljeGlavno[i]+'.swf','');
this['konjT'+i]._x=i*10;
this['konjT'+i]._alpha=0;
}
_parent.gotoAndStop("igra");
What's Wrong With My Code?
on (release) {
tellTarget ("sdii.swf") {
secondarySP.loadScrollContent("david-picture.swf");
}
}
can any one tell what's wrong here.. it pops up and says can not find target= "sdii.swf".
thanks in advance
What's Wrong With My Code?
Hi I have a problem somewhere in my code here:
I have a movie with 5 Layers and 2 Frames.
In the Actions Layer I have:
myLoop = new Sound(myLoopMc);
myLoop.attachSound("myLoop01");
myLoop.setVolume(myLoopVolume);
myLoopVolume += 10;
MyLoop.start (0,999);
In the Sound Object Layer I have:
this.onEnterFrame = function() {
if(fadeIn01 = 1) {
_root.myLoop.setVolume(myLoopVolume);
myLoopVolume += 10;
if(myLoopVolume > 99) {
fadeIn01 = 0;
_root.myLoop.setVolume(myLoopVolume);
myLoopVolume = 100;
}
}
if(fadeOut01 == 1) {
_root.myLoop.setVolume(myLoopVolume);
myLoopVolume -= 10;
if(myLoopVolume < 5) {
_root.myLoop.stop("myLoop01");
fadeOut01 = 0;
}
}
}
Also in Frame 1 I have a layer called Mute with a button that has this code:
on (press) {
gotoAndPlay(2);
}
on (press) {
fadeOut01 = 1;
}
...and the Frame itself has a stop(); because in Frame 2 I have a UnMute Button with the code:
on (press) {
gotoAndPlay(1);
}
on (press) {
fadeIn01 = 1
}
...and Frame 2 also has a stop(); so that it doesn't go right back to Frame 1.
NOW, the problem is is that when I go to test this myLoop plays and fades in correctly, but for some reason my buttons are not working to fade the music in and out. I actually think only my Mute button is not working because when I click the unmute button it adds myLoop again, which is what it is suppose to do if Mute would have worked correctly in the first place.
Maybe it is the way I started the loop in the first place? I try just using this:
myLoop = new Sound(myLoopMc);
myLoop.attachSound("myLoop01");
myLoop.setVolume(myLoopVolume);
myLoopVolume = 0;
fadeIn01 = 1;
or this:
myLoop = new Sound(myLoopMc);
myLoop.attachSound("myLoop01");
fadeIn01 = 1;
but they don't seem to work either! I am sure that I should be able to set that fadeIn01 = 1; at the first frame and have it work but it is not working.
HELP PLEASE, VERY URGENT!!!
Thanks a lot!
What's Wrong With My Code?
I've got music playing in the first frame of my main timeline. It's linkage is set to "musicloop".
I have an MC, on another layer which is a pop-up menu ("navigation") and within this is a button. On clicking this button I want to set the volume of the music on the first frame of the timeline to "0". Then on the clicking of another button set it to 100.
Here's what I've got, but it's not working:
on (release) {
_root.musicloop.setVolume(0);
}
I'm a TOTAL novice at Actionscript so any help would be great.
Thanks
Wrong Code?
I have two movies communicating with each other. One of them is the main swf and the other loads into a container within the main swf. Okay, the actions I have on the buttons within the "To Be Loaded" movie do not function or work and the movie does nothing when it is cale dinto this container in the main movie? I thought the reason may be that I had a _root call on the buttons function in the "To-Be-Loaded" ovie, and changed it to _parent and even _this, but still nothing works. If anyone can help me out I will provide you with the fla for you to see what I am talking about.
My email is: craigmu@bgnet.bgsu.edu
Thanks
What's Wrong In My Code?
Hi all,
I hope someone sees what I'm not seeing... I am still a bit new to ActionScript, so I can imagin that my code is a bit silly, but even with my simple code, flash gives me a hard time...
I have an external php-script giving back a 2 variables, lowbasket and oldbasketvalue. In lowbasket is which one of my 20 baskets in the lowest, and php automaytically clears that one. I want to animate this clearing-proces, and so I want to countdown the number of items in the basket.
Now in frame 4 I have a line that calls a shim-movie,
loadMovieNum("http://www.mydomain.com/shim.swf?action=emptybasket", 1);
which loads the variables from flash, the variables arrive at level1. After the shimmovie is loaded, I've put a gotoAndPlay(18); and frame 18 is empty, so it can be used to loop from frame 18 to frame 19. In frame 19 is the code below, but every time I click the button in my movie, I see 1 countdown (or sometimes even nothing), and my movie entirely restarts(at frame1... the pre-loader)...
Does anybody see what I'm doing wrong???
if(_level1.oldbasketvalue<>""){
if(_level1.waitvar==""){
_level1[_level1.lowbasket]=_level1.oldbasketvalue;
_level1.waitvar = 1;
}
if(_level1.waitvar=="1"){
_level1.oldbasketvalue--;
_level1[_level1.lowbasket]--;
_level1.outofbasket++;
if(Number(_level1.oldbasketvalue)<1){
_level1.oldbasketvalue="";
_level1.waitvar = 2;
} else {
gotoAndPlay(18);
}
}
} else if((_level1.oldbasketvalue=="")and(Number(_level1. waitvar)==2)){
_level1.waitvar="";
gotoAndPlay(15);
} else {
gotoAndPlay(18);
}
What's Wrong With This Code?
Hello. I've been attempting to create a basic multi-user environment with flash, using at text file and a for loop to check passwords and users. I know it's not very efficient, I just want to see if I can do it. what I'm wondering is, why can't this code tell me that the password is correct, if it is?
code: on (release) {
for (i=1; i<=users.usercount; i++) {
if (field1 == [users.user]+i) {
if (field2 == [users.pass]+i) {
trace("stuff correct");
}
} else {
trace("stuff incorrect");
}
}
}
"users" is the loadvar I'm using.
"usercount" is the max number of users.
field1 is the username field
field2 is the password field
users.pass is the password var(pass1,pass2, etc.)
users.user is the username var(user1,user2, etc.)
Thanks for the help,
Spidy
What's Wrong With My Code?
var n = Math.round(Math.random()*24+1);
var i = 0;
for(i=1; i<25; i++) {
_root["box"+i].onPress = function() {
if (i == n) {
gotoAndPlay(2);
} else {
gotoAndPlay(3);
};
};
};
stop();
Why do I get the 'wrong page' even if it's right? pls compare with the more longwinded version.
What's Wrong With This Code?
Can somebody tell me what is wrong with this code? It just won't work:
if (page == menu0) {
_root.pics.gotoAndPlay("0");
} else if (page == menu1) {
_root.pics.gotoAndPlay("1");
} else if (page == menu2) {
_root.pics.gotoAndPlay("2");
}
the obvious:
- the MC pics IS indeed called/assigned "pics" and IS indeed on the root/level 0
- 0, 1 and 2 are labels (hence the quotes) and the labels exist inside the pics MC
- the variable page exists (I am displaying it inside a dynamic text box showing the value of the page var to make sure it exists)
- menu0 menu1 and menu2 do have variables assigned and one of them is always of same value of the var page
even after all of this it just won't do what it's supposed to do!
the pics MC always stays on the 1st frame (which has a stop in it) and never goes to the other frames...
help please I am pulling my hair out for 3 hours now
Tell Me What's Wrong With My Code Please
I am just learning how to make a platform game. I have a mc hero and two levels. I have a jumping script, left/right script, and a gravity script. The problem is that when I make the hero jump it jumps and then falls through the floor. Here is the script please help me...
//right left movement
onClipEvent (load)
{
step=5;
MovieWidth=300;
MovieHeight=300;
}
onClipEvent (enterFrame) {
if (Key.isDown (Key.RIGHT) && this._x< MovieWidth)
{
this.attachMovie ("square", "square1", 10);
this._x+=step;
}
else if (Key.isDown (Key.LEFT) && this._x > 0)
{
this.attachMovie ("square_l", "square2", 10);
this._x-=step;
}
}
//jumping
onClipEvent (load)
{
vel_y = 0;
jumping = false;
}
onClipEvent(enterFrame)
{
if (Key.isDown (Key.SPACE) && !jumping)
{
vel_y = 10;
jumping = true;
}
if (jumping)
{
vel_y -= 1;
if (vel_y <= -10) vel_y =- 10;
this._y -= vel_y;
}
if (_root.ground.hitTest (this._x, this._y+15, true))
{
vel_y = 0;
jumping = false;
}
}11
I Can't See What's Wrong With This Bit Of Code
---Flash MX---
can anyone tell me why this bit of code doesn't work...
secCount = now.getSeconds() - 1;
mincnt = now.getMinutes() - 1;
hourcnt = now.getHours() % 12 - 3;
if (mincnt > 30)
{
minCount == mincnt - 30;
hourCount == hourcnt;
}
else
{
minCount == mincnt + 30;
hourCount == hourcnt + 1;
}
// end if
hourCount--;
What I'm trying to do is find a way to adjust a clock to a specific time zone using UTC (Universal Time Code). The problem, however, is that the time zone I wish to adjust to is Newfoundland (Newfoundland is -3:30 GMT), so I have to adjust the minutes as well, and therefore compensate the hour to adjust for the first half an hour of every hour.
I need a bit of help on this, as I don't have much experience with using Flash.
Fla included, the piece of code is in frame 1 of Clock Target
What Is Wrong With My Code
Hi I have a few buttons on the stage and a simalar quantity of mc's with the same suffix as the buttons I would like to change the color of the movieclips at rollOver and restore the color again at rollOut. To do so I came up with the following function:
Code:
function buttons() {
for (var i in this) {
if (this[i]._name.substr(0, 4) == "btn_") {
clip = this[i];
clip.myOver = _root["rollOver_"+clip._name.substr(4, clip._name.length)];
clip.onRollOver = function() {
this.myOver.setRGB(0xD86C01);
};
clip.onRollOut = function() {
new Color(myOver).setRGB(0xCC6600);
};
}
}
}
buttons();
What's Wrong With This Code?
I want a button that I can rollOver and it play part of a time line by using with (I successfully did that, but the rollOut part of the button isn't working).
Here's the code...
'
on(rollOver){
with(IntroButtonLogo)
gotoAndPlay("OverIntro");
}
on(rollOut){
_root.gotoAndStop("IntroButtons");
}
'
Any help would be appreciated.
What's Wrong With This Code?
Hi all
has anyone got any idea why the following code works in flash player 6 but not in 7?????
onClipEvent (load) {
//How fast to move the menu.
ratio = 0.3;
//Set local left and right variables.
left = _root.menu1.left;
right = _root.menu1.right;
}
onClipEvent (enterFrame) {
o_x_pos = _root.menu1.button1_x;
o_y_pos = _root.menu1.button1_y;
mag = _root.menu1.magnet;
//Move towards mouse when in the set area.
if (_root._ymouse > ((o_y_pos-50) - mag) & _root._ymouse < ((o_y_pos-50) + mag) & _root._xmouse > left & _root._xmouse < right) {
n_x_pos = x_pos - _root.menu1._xmouse;
x_pos = x_pos - (n_x_pos * ratio);
this._x = x_pos;
n_y_pos = y_pos - _root.menu1._ymouse;
y_pos = y_pos - (n_y_pos * ratio);
this._y = y_pos;
//Move towards original position in the set area.
} else {
n_x_pos = x_pos - o_x_pos;
x_pos = x_pos - (n_x_pos * ratio);
this._x = x_pos;
n_y_pos = y_pos - o_y_pos;
y_pos = y_pos - (n_y_pos * ratio);
this._y = y_pos;
}
}
i've not use flash for a while and a bit rusty, so any help is welcome
Thanks
What Is Wrong With This Code?
Flash:
on (release) {
sendVar = new LoadVars();
sendVar.xPos = 23;
sendVar.send("conto.php", "GET");
}
PHP:
<?
$xPos = $_GET['xPos'];
$handle = fopen("test.txt", "a");
fwrite($handle, $xPos);
fclose($handle);
?>
Php Creates a test.txt file, but it does not write the variable i'm sending from flash.
WHY?
Wrong Code?
hi, thanks to you guys i catched up quite a little flashcoding...
a got 3 possibilities to make the grey box fading in/out when i roll on/over the red square...
but with one solution i have a problem: why won´t it fade out when roll out the red square ----
could somebody have a look at the code
cheers,
leiss
Anything Wrong With This PHP Code ?
Hi,
The form designed in flash is fine, but the mail.php doesn't seem to be right. So when I try emailin via the uploaded form online, the message doesn't go through. I checked with my hosting service and they said:
"Raj, PHP has the sendmail binary compiled in. More than likely it is the
code. Please troubleshoot this issue.
I have confirmed that php mail has been working properly using this code."
I don't get it. But it seems like a tiny error somewhere in this PHP is making the form to not work. Below is the code in the mail.php file I'm using. If anyone can spot something wrong, please advise, and it will be much appreciated. Thanks.
-Raj
<?
foreach ($_POST as $key => $value) {
$_POST[$key] = mb_convert_encoding($value, "ISO-8859-1", "UTF-8");
}
$name=$_POST["name"];
$first_name=$_POST["first_name"];
$street=$_POST["street"];
$number=$_POST["number"];
$city=$_POST["city"];
$postcode=$_POST["postcode"];
$email=$_POST["email"];
$comment=$_POST["comment"];
$comment=str_replace("
","
",$comment);
$ToEmail = "dreamraj@aol.com";
$ToName = "Me";
$EmailBody = "Sender: $first_name $name
E-mail: $email
Street: $street $number
$postcode $city
Message:
$comment
";
$Message = $EmailBody;
$Subtext=" [gen::www.dreamraj.com]";
$wasSent=mail($ToEmail,$Subtext, $Message, "From: ".$name." <".$email.">"."
X-Accept-Language: pl, en-us, en
Content-Type: text/plain;charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable");
print("&error=false");
?>
What Is Wrong With This Code?
I got the following code from the internet. It makes an array from data that came from a XML file and makes a menu with subitems from it. the problem with the code is that it places all the buttons over eachother, so you can only see one button in stead of four.
does someone see the problem in this code?:
Code:
function menuOut(xml, movW, mcH, mcW, xpos, ypos)
{
xpos = xpos;
ypos = ypos;
startPos = xpos;
items = xml.firstChild.childNodes;
for (a = 0; a <= items.length - 1; a++)
{
subs = xml.firstChild.childNodes[a].childNodes;
iattrib = items[a].attributes;
item = _root.attachMovie("menuItem", "item" + a, a);
item.nametxt.text = iattrib.id;
subContain = _root.createEmptyMovieClip("subContain" + a, a + 1000);
for (b = 0; b <= subs.length - 1; b++)
{
attribs = subs[b].attributes;
sub = _root.subContain.attachMovie("menuItem", "sub" + b, b + 100);
sub.nametxt.text = attribs.id;
sub._y = mcH * b + mcH;
sub.itemUrl = attribs.theURL;
sub.onRelease = function ()
{
getURL(this.itemUrl, "_blank");
};
} // end of for
_root["subContain" + a]._visible = false;
_root["subContain" + a]._x = xpos;
_root["subContain" + a]._y = ypos;
item.num = a;
item.box.subsL = subs.length;
_root["item" + a].box.onRollOver = function ()
{
this._height = this.subsL * mcH + mcH + 8;
trace (this._height);
};
_root["item" + a].onMouseMove = function ()
{
mY = _root._ymouse;
mX = _root._xmouse;
this.subHit = _root["subContain" + this.num].hitTest(mX, mY);
this.itemHit = this.box.hitTest(mX, mY);
if (this.itemHit == true)
{
_root["subContain" + this.num]._visible = true;
}
else
{
_root["subContain" + this.num]._visible = false;
this.box._height = mcH;
} // end if
};
item._x = xpos - 10;
item._y = ypos;
xpos = xpos + xMove;
if (xpos >= movW - mcW / 2)
{
ypos = ypos + yMove;
xpos = startPos;
} // end if
} // end of for
} // End of the function
menu = new XML();
menu.ignoreWhite = true;
menu.load("http://purephotoshop.com/uploads/submen.xml");
menu.onLoad = function ()
{
menuOut(this, 350, 25, 125, 75, 15);
};
What's Wrong With This Code?
for (i=0;i<6;i++){
eval("newposition"+i) = eval("_rootosition"+i)
}
I am trying to create a variable and add "i" so that I don't have to write it out 6 times.
It keeps giving me this error message:
Symbol=controller, Layer=Layer 1, Frame=2: Line 3: Left side of assignment operator must be variable or property.
eval("newposition"+i) = eval("_rootosition"+i)
Isn't it a variable?
I'm just not great at hardcoding (if that's what you call it).
Appreciate any help
What's Wrong With This Code...
Ok I'm trying to have a button that not only changes the color of my object within my movieclip, but also tells it to go to frame 2 where theres another object on a layer above it. I can't seem to get it to work. What am I doing wrong here?
on(release){
myColor1.setRGB(0x000000);
_root.Color1.gotoAndPlay(2);
}
Help Me What Is Wrong With This Code...
ok heres the scoop...
i want to make it so that if i click on a button... it gotoAndPlays to a frame in a MC and then if u click again... it doesn't do anything...
... but you can continuously click on the button and it will keep replaying...
heres my code...
Code:
on(release){
if(_global.option = true){
_global.option = false;
tellTarget("orb"){
gotoAndPlay(14);
}
}
}
Please help me...
if you need me to explain it better... just post... or if you want to see it...
Another Problem...
ok i want my project to change scenes when you click on a button...
but when you click on the button it goes to the last scene i inputed...
heres the code for that...
Code:
on(release){
if(_global.diff = 1){
_root.gotoAndPlay("Easy", 1);
}
}
on(release){
if(_global.diff = 2){
_root.gotoAndPlay("Advanced", 1);
}
}
on(release){
if(_global.diff = 3){
_root.gotoAndPlay("Hard", 1);
}
}
it's on the root of the scene... Please Help...
What Is Wrong With This Code?
I was able to check that my problem can be solved by removing the actionscript that i have. That means that there is something wrong with it, although i cant find the problem... And the problem is : I CANT SURF between fields (text and combo boxes) using the Tab key. And when i choose a combo box, the focus doesnt want to leave that same field, i have to double click the next field in order to move the focus...
You can check it for your self here:
www.protrampo.com/soft/example.zip
here is the code that i am using..
FIRST FRAME:
Code:
m_u_name ="";
m_u_sur ="";
m_u_nick ="";
m_u_email ="";
m_u_age ="";
m_u_state ="";
m_u_city ="";
m_g_g=" ";
m_g_c=" ";
SECOND FRAME:
Code:
var cb_gender:Object = new Object();
m_u_gender.addEventListener("change", cb_gender);
cb_gender.change = function()
{
m_g_g = m_u_gender.value;
m_ug_stat = m_g_g;
}
var cb_country:Object = new Object();
m_u_country.addEventListener("change", cb_country);
cb_country.change = function()
{
m_g_c = m_u_country.value;
m_uc_stat = m_g_c;
}
stop();
Its really WEIRD, since the as looks ok although, as i said before, i CANT surf between the different fields using the tab KEY.
Thanks a lot.
Cheers.
Leo.
What's Wrong With This Code. Thanks
hi, please help me with the following code:
Code:
// create two empty movie clips
_root.createEmptyMovieClip("bk_container", 0);
_root.createEmptyMovieClip("mc_container", 1);
// load elements to the movie clips
bk_container.loadMovie("./bk.jpg");
mc_container.loadMovie("./mc.swf");
// move mc_container to the center of 800 x 600 workspace
// but mc_container._width = 0 & mc_container._height = 0
mc_container._x = 400-(mc_container._width/2);
mc_container._y = 300-(mc_container._height/2);
// create function to drag the mc_container
// but don't work
mc_container.onPress = function() {
startDrag(this, false, 0, 0, 800, 600);
dragging = true;
};
mc_container.onRelease = function() {
stopDrag();
dragging = false;
};
stop();
something must be missing, please advise.
What Is Wrong With My Code?
hi there, i've tried to edit this code for a few days and it just wont work!
Its supposed to create the new movie clip, then load in the image from the php results
the php works fine and read the mysql perfectly! I think i'm just not calling the variable properly in the loop?
the php gives lots of info...
echo "&id" . $i . "=" . $cat["id"];
echo "&name" . $i . "=" . $cat["name"];
echo "&url1" . $i . "=" . $cat["url1"];
echo "&url2" . $i . "=" . $cat["url2"];
echo "&price" . $i . "=" . $cat["price"];
Code:
// Import the transitions classes so you can add a fading effect when the images load to the Stage.
import mx.transitions.*;
// Set the starting X and Y positions for the gallery images.
_global.thisX = 30;
_global.thisY = 70;
/* Set static values for the Stage's width and height.
Using Stage.width and Stage.height within the code results in
strangely positioned full images when testing in the Flash environment
(but the problem doesn't exist when published to a SWF file). */
_global.stageWidth = 600;
_global.stageHeight = 400;
/* create a function which loops through the images in an array,
and creates new movie clips on the Stage. */
function displayGallery(gallery_array:Array) {
var galleryLength:Number = gallery_array.length;
// loop through each of the images in the gallery_array.
function loadPictures()
{
myPictures = new LoadVars()
myPictures.load("getPictures.php")
myPictures.onLoad = function(success)
{
if(success)
{
for (var i = 0; i<galleryLength; i++) {
/* create a movie clip instance which holds the image. We'll also set a variable,
thisMC, which is an alias to the movie clip instance. */
var thisMC:MovieClip = this.createEmptyMovieClip("image"+i+"_mc", i);
/* load the current image source into the new movie clip instance,
using the MovieClipLoader class. */
mcLoader_mcl.loadClip(myPictures["picName" + i], thisMC);
// attach the preloader symbol from the Library onto the Stage.
preloaderMC = this.attachMovie("preloader_mc", "preloader"+i+"_mc", 5000+i);
/* set the preloader's bar_mc's _xscale property to 0%
and set a default value in the progress bars text field. */
preloaderMC.bar_mc._xscale = 0;
preloaderMC.progress_txt.text = "0%";
// set the _x and _y coordinates of the new movie clip.
thisMC._x = _global.thisX;
thisMC._y = _global.thisY;
// set the position of the image preloader.
preloaderMC._x = _global.thisX;
preloaderMC._y = _global.thisY+20;
// if you've displayed 5 columns of images, start a new row.
if ((i+1)%5 == 0) {
// reset the X and Y positions
_global.thisX = 20;
_global.thisY += 80;
} else {
_global.thisX += 80+20;
}
}
}
// define the MovieClipLoader instance and MovieClipLoader listener Object.
var mcLoader_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadStart = function() {
};
// while the content is preloading, modify the width of the progress bar.
mclListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
var pctLoaded:Number = Math.round(loadedBytes/totalBytes*100);
// create a shortcut for the path to the preloader movie clip.
var preloaderMC = target_mc._parent["preloader"+target_mc.getDepth()+"_mc"];
preloaderMC.bar_mc._xscale = pctLoaded;
preloaderMC.progress_txt.text = pctLoaded+"%";
};
// when the onLoadInit event is thrown, you're free to position the instances
mclListener.onLoadInit = function(evt:MovieClip) {
evt._parent["preloader"+evt.getDepth()+"_mc"].removeMovieClip();
/* set local variables for the target movie clip's width and height,
and the desired settings for the image stroke and border. */
var thisWidth:Number = evt._width;
var thisHeight:Number = evt._height;
var borderWidth:Number = 2;
var marginWidth:Number = 8;
evt.scale = 20;
// draw a white rectangle with a black stroke around the images.
evt.lineStyle(borderWidth, 0x000000, 100);
evt.beginFill(0xFFFFFF, 100);
evt.moveTo(-borderWidth-marginWidth, -borderWidth-marginWidth);
evt.lineTo(thisWidth+borderWidth+marginWidth, -borderWidth-marginWidth);
evt.lineTo(thisWidth+borderWidth+marginWidth, thisHeight+borderWidth+marginWidth);
evt.lineTo(-borderWidth-marginWidth, thisHeight+borderWidth+marginWidth);
evt.lineTo(-borderWidth-marginWidth, -borderWidth-marginWidth);
evt.endFill();
};
loadPictures();
stop();
What's Wrong With This Code?
I'm placing this code on the first frame of a movie:
button1_URL = "http://www.google.com";
_root.button1.button.but.release {
getURL(button1_URL);
}
'but' is the instance name of a button symbol andI want it to getURL("http://www.google.com")
But it's giving me a syntax error - should I not be using .release?
[F8] Please Let Me Know What I Am Doing Wrong In This Code.
*** Read the explanation at the bottom *****
import flash.external.*;
var pushSuccess:Boolean = ExternalInterface.addCallback("button_pushed", null, pushed);
var releaseSuccess:Boolean = ExternalInterface.addCallback("button_released", null, released);
var externalAvala:Boolean = ExternalInterface.available;
trace(externalAvala)
var messageSender:Object;
var messageReciever:Object;
function pushed(Num) {
messageSender.broadcastMessage("button_pushed", Num)
_root.application.DVD["B" + Num].gotoAndPlay(2);
trace("Button Push" + Num )
}
function released(Num) {
messageSender.broadcastMessage("button_released", Num)
_root.application.DVD["B" + Num].gotoAndPlay(2);
trace("Button Release" + Num )
}
worker.button_released = function ProcessPush(){
trace("Processed Push");
}
worker.button_pushed = function ProcessRelease(){
trace("Processed Release");
}
messageSender.addListener(messageReciever);
AsBroadcaster.initialize(messageSender);
ExternalInterface.addCallback("button_released", null, released);
ExternalInterface.addCallback("button_pushed", null, pushed);
var Binitialised:Boolean = messageSender.addListener(messageReciever)
trace("Binitialised " + Binitialise);
I get two errors saying that I cant define the process push and process release functions where they are.
The idea eventually is to have button objects register themselves to a eventbroadcaster. When a external button state message comes buttons respond without having to address them individually. There may be a couple of hundred buttons on different forms so writing the path references would take forever.
I am hoping to have the buttons(movie instances) host the addlistener call using "this" to reference itself. Also a function registered to the event that calls a central function passing its alias which can be used to determine if the message was intended for it and if so act on it. There fore having a generic piece of code in each button.
What a mouth full.
Please help
THanks in advance
What Do You See Wrong In This Code?
Before converting to As 2.0 from as 1.0 and fp 6 this code loaded an image just fine.
see code:
Code:
if (_root.templatedir ne "") {
loadMovie(_root.templatedir add "/" add _root.category add "/" add _root.theme add ".swf", "loadmoviebottom");
} else {
if (_root.templatedir1 ne "") {
loadMovie(_root.templatedir1 add "/" add _root.category add "/" add _root.theme add ".swf", "loadmoviebottom");
} else {
loadMovie(theme add ".swf", "loadmoviebottom");
}
}
after converting to as 2.0 and fp 8 and 9 the code wont load anymore
see code:
Code:
if (_root.templatedir != "") {
loadMovie(_root.templatedir + "/" + _root.category + "/" + _root.theme + ".swf", "loadmoviebottom");
} else {
if (_root.templatedir1 != "") {
loadMovie(_root.templatedir1 + "/" + _root.category + "/" + _root.theme + ".swf", "loadmoviebottom");
} else {
loadMovie(theme + ".swf", "loadmoviebottom");
}
}
I've experimented with both "==" and 'ne" operators and nothing happens.
the only way that I can get the images to load i if I publish in flash player 6 and I need for it to work in fp 8 and up.
please what is wrong with this code?
Can Anybody Tell Me What Is Wrong With This Code?
Hi,
I'm creating a simple sound component that plays a sound file in the library, it takes V_Source parameter as the linkage name in the library, and V_Button parameter as the name of the button that will play the sound.
var soundClass = flash.utils.getDefinitionByName(this.V_Source) as Class;
var currentlyPlayingSound = new soundClass();
var currentSoundChannel = new Object;
MovieClip(parent)["this.V_Button"].addEventListener(MouseEvent.CLICK,PlaySound);
function PlaySound(event:MouseEvent) {
currentSoundChannel = currentlyPlayingSound.play();
}
I have this error:
TypeError: Error #1010: A term is undefined and has no properties.
at SoundRepeater_fla::Symbol1_1/frame1()
Something Is Wrong With This Code...
Something is wrong with this code The codes format is all funky but I wanted you to be able to read it better:
onClipEvent (enterFrame) {
if (strength>1)
{
on (press) {strength-=1}
}
}
The output window says:
**Error** Scene=Menu, layer=Layer 1, frame=10:Line 5: on handlers may not nest within other on handlers
on (press) {strength-=1}
Total ActionScript Errors: 1 Reported Errors: 1
What's Wrong With This Code?
I have 2 variables: take1 and take2, which store randomly generated numbers. I have the following code which doesn't seem to work:
Quote:
pick1=random(22);
if (take1==take2)
{pick1=random(22)};
There are times when take1 and take2 are definitely the same but the if statement does not seem to run, ie. pick1 is not regenerated.
Any ideas?
What's Wrong With This Code?
ActionScript Code:
_root.createEmptyMovieClip( "grad", 1 );
with ( _root.grad )
{
colors = [ 0xFF0000, 0x0000FF ];
alphas = [ 100, 100 ];
ratios = [ 0, 0xFF ];
matrix = { a:200, b:0, c:0, d:0, e:200, f:0, g:200, h:200, i:1 };
beginGradientFill( "linear", colors, alphas, ratios, matrix );
moveto(100,100);
lineto(100,300);
lineto(300,300);
lineto(300,100);
lineto(100,100);
endFill();
}
doesn't work for me.
What's Wrong In My Code?
Hi,
With the following code on a button in my SWF I want to open a HTML called "EngelskRam.html"(embedding another SWF) but I want it to be opened in a NEW BROWSER WINDOW. But by some reason, the new SWF opens up in the window we're already in. Can you see what I've done wrong?
Best regards,
WTK
ActionScript Code:
on (release) {
getURL("javascript:NewWindow=window.open('http://www.wilhelmhagberg.com/acacia/EngelskRam.html','newWin','width='+screen.availWidth+',height='+screen.availHeight+',left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes,fullscreen=Yes'); NewWindow.focus(); void(0);");
}
What Wrong With This Code?
If have never put my codes on a movie clip.And I think I'g regretting it now.I can't get this code to work.
ActionScript Code:
onClipEvent (enterFrame) {
_x -= _root.speed;
if(_x == 68.0){
jump()
}
}
The problem is the jump function won't work.Probably a scope problem or something.
I even tried using
ActionScript Code:
_root.jump()
I have jump as jump = function not
var jump:
Thanks
What's Wrong With This Code?
Hello everybody,
I'm new to this forum but I'm not new to Actionscript. But this is the first time I have to print something from my swf. I coded a sort of image viewer using mtasc and swfmill. The movie loads images defined in an xml file, and the user should be able to print them using a button. The printed image should fit the page width and be printed in how many pages are needed to show it in its entire height. Ok, I said after reading the documentation: I need to resize the image according to the page width and then add as many pages as needed to print all its "slices".
The code is:
public function printMovieClip(movie : MovieClip) {
var pj : PrintJob = new PrintJob();
if (!pj.start()) {
return;
}
var pageWidth = pj.pageWidth;
var pageHeight = pj.pageHeight;
/* scale factor computed according to the page width */
var factor = 100. * pageWidth / movie._width;
movie._xscale = factor;
movie._yscale = factor;
var offset = 0;
/* image is sliced along its height in many parts as needed */
while (offset < movie._height) {
pj.addPage(
movie,
{ xMin : 0, xMax: pageWidth,
yMin: offset, yMax: offset + pageHeight }
);
offset += pageHeight;
}
pj.send();
movie._xscale = 100;
movie._yscale = 100;
}
Actually it prints something, but the images are sliced oddly. Any ideas?
Thank you,
l0r3
What Is Wrong With This Code?
I started learning to code yesterday. I wanted to create a basic physicengine to have as a base when making games.
This function is not doing what it's supposed to do:
Code:
ball_mc.bGravity = true;
ball_mc.speed_y = -10;
ball_mc.speed_x = 3;
stageWidth = 550;
stageHeight = 400;
function borders() {
if (this.bGravity = true) {
if (this._x>stageWidth+(this._width/2)) {
this.speed_x *= -1;
}
if (this._x<0-(this._width/2)) {
this.speed_x *= -1;
}
if (this._y>stageHeight+(this._height/2)) {
this.speed_y *= -1;
}
if (this._y<0-(this._height/2)) {
this.speed_y *= -1;;
}
}
}
ball_mc.onEnterFrame = borders;
I want the 'ball_mc' to bounce when it touches the sides. But it simply stopped moving the moment I added this function, I don't know why because the ball shouldn't even be affected by this function when it's out on the playfield.
What's Wrong With This Code ?
Can anyone tell me whats wrong with the following code?
on (rollOver) = function(){
jp_btn._visible = false
}
when ever I click the "check syntax" buttone it comes up with this message:
**Error** Scene=members, layer=snoop, frame=1:Line 1: '{' expected
on (rollOver) = function(){
Total ActionScript Errors: 1 Reported Errors: 1
I just don't know where to put the {.
Please help me. Ta.
What's Wrong With This Code?
Hello everyone...i been busting my head to figure why flash doesnt listen to this code but i cant find the answer
button2.onRelease = function(){
removeMovieClip(holder_mc);
trace(holder_mc);
_root.createEmptyMovieClip("holder_mc",10);
holder_mc._x=400;
holder_mc._y=100;
loadMovie("mech_brain.png",_root.holder_mc);
}
stop();
The external image loads just fine...but the problem is that the holder_mc doesnt display where i want the x and y to be (that is x=400 and y=100)
instead it displays on the top left side of the swf file. What ever number i put it always places the holder_mc there.....Anyone has any suggestions?
Note: The button2 is inside a mc "bath_thumbnail" which is inside another mc "computer_paint" does this help?
|