Class Troubles...
I'm experimenting with classes and i'm getting a bit annoyed cuz flash can't load my class file.
I set the class of one of the movie clips to "Enemies" and here's the code for "Enemies.as"
Code: class Enemies{ var myhealth:Number var mytype:String function displaystuff(){ trace("I'm a "+mytype +" enemy and i have "+myhealth +" health left") } } but, whenever i preview the movie in flash it says "The class or interface 'Enemies' could not be loaded." why? i have flash 8, if it helps
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 09-19-2006, 10:37 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Class Troubles.
I have a file: CurrencyConverter.fla which I have exported to CurrencyConverter.swf. In it is 1 frame with the ASv2 of:
ActionScript Code:
import MyTesting.CurrencyConverter;
var rate:Number = 0.634731;
var converter:CurrencyConverter = new CurrencyConverter(rate);
var result:Number = converter.convert("ISD", 130.5);
trace(result);
I have a folder called MyTesting in the CLASSPATH. Inside it is a file called CurrencyConverter.as.
The ASv2 in that file is:
ActionScript Code:
class CurrencyConverter {
var exchangeRate:Number;
function CurrencyConverter(rate:Number){
exchangeRate = rate;
}
function convert(convertTo:String, amount:Number):Number {
var result:Number;
if (convertTo == "USD") {
return amount / exchangeRate;
} else if (convertTo == "GBP") {
return amount * exchangeRate;
}
return result;
}
}
Thanks to a previous post, I'm using the SE|PY AS Editor (since FMX2K4 doesn't come with one) and I'm gettin an error in this class file of:
Syntax Error: unexpected token IDENT expecting ASSIGN or ++ or -- at line 1
When I run the Flash Movie I get:
**Error** C:Documents and SettingsamartoneLocal SettingsApplication DataMacromediaFlash MX 2004enConfigurationClassesMyTestingCurrencyConverter.as: Line 16: Syntax error.
}
Total ActionScript Errors: 2 Reported Errors: 2
undefined
Any ideas guys?
[F8] First Class Variable Troubles
I'm trying to get a class working in ActionScript 2 and having real problems
hopefully someone can help me with the following code
class library.classes.XML_Loader {
var _file:String;
var data_xml:Object;
var i:Number;
var _targetText:String;
var target:String;
var sortItOut:String = "sorted";
//
public function XML_Loader(file,targetText) {
_file = file;
_targetText = targetText;
}
public function update() {
trace("loading xml file = " + _file);
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(_file);
//
function sendData() {
trace("this is..." + sortItOut);
}
function loadData(success) {
trace("xml loaded");
data_xml = this.toObject();
trace(data_xml.siteMenu.button.length);
target = "button_";
for(i=0; i<data_xml.siteMenu.button.length +1; i++) {
_root[target + i]._textField.text = data_xml.siteMenu.button[i-1].buttonLabel;
}
}
//
XML.prototype.toObject = function () {
var $xparse = function (n) {
var o = new String (n.firstChild.nodeValue), s, i, t
for (s = (o == "null") ? n.firstChild : n.childNodes[1]; s !=
null; s = s.nextSibling) {
t = s.childNodes.length > 0 ? arguments.callee (s) :
new String (s.nodeValue)
for (i in s.attributes) t[i] = s.attributes[i]
if (o[s.nodeName] != undefined) {
if (!(o[s.nodeName] instanceof Array)) o
[s.nodeName] = [o[s.nodeName]]
o[s.nodeName].push (t) }
else o[s.nodeName] = t }
return o }
return $xparse (this)
}
}
}
The problem is that i can't get info (variables) into (or out of) the loadData(success) function.
I've tried just about every workaround i can think of, but this time i'm well and truly stumped.
One solution would be to move the for-loop out of the function, but then it doesn't recieve the xml to spread around the site.
Thanks in advance to anyone who can shed some light on this!
[F8] Tween Class Troubles
I'm using the Tween class to fadeIn, Pause, and fadeOut an image in Flash 8.
I have functions that work in a loop - loadImage function triggers fadeIn triggers Pause triggers fadeOut triggers loadImage etc...
This is all working dandy. However, I want to be able to click a thumbnail and whatever tween it's doing should stop, and jump to the fadeOut function, which would then call the load function, starting the process over. What's actually happening when I click the thumbnail is it does jump to fadeOut, but the other tween doesn't stop, so I now have multiple loops going on (like Row, Row, Row Your Boat in staggered choruses).
I've tried giving the instances of myTween different names, I've tried myTween.stop(), but it doesn't help. I just keep getting competing function loops.
Any suggestions?
Thanks
[F8] Tween Class Troubles
Hey all,
So I am working on a project in which I need to move objects dynamically using actionscript. Basically there are 60 instances of the same card which you can click on (they are named card 1-60) and that card which you have clicked needs to move to a specified spot on the stage.
Within the card MC is a button that gets a few variables on click; it gets the name of which card was clicked and stores it as a variable, as well as which card in sequence you have clicked (after you choose 6 cards, something else happens.)
Anyway, in the card MC code it also activates a function on the Root timeline, which SHOULD input the name of the card clicked as a variable, as well as its X and Y position, and move it to a certain spot on the stage (I haven't worked out where yet, I just want to get it to move SOMEWHERE for now). Here is my code so far:
PHP Code:
var thisCardPosX;
var thisCardPosY;
function moveCard() {
trace(thisCardPosX);
import mx.transitions.Tween;
import mx.transitions.easing.*;
var xPosT:Tween = new Tween(thisCard, "_x", Regular.easeInOut, thisCardPosX, 0, 1, true);
var yPosT:Tween = new Tween(thisCard, "_y", Regular.easeInOut, thisCardPosY, 0, 1, true);
xPosT.onMotionFinished = function() {
trace("moveDONE!");
};
yPosT.onMotionFinished = function() {
};
}
It doesn't work! I'm not sure why. Am I using the tween class wrong? From what I can tell it SHOULD be moving the card from its current position (the variable is changed with the code inside the card's MC, it traces properly at least) to 0 on the stage (top left.) It doesn't even move! Please help!
Register Class Troubles
hi there,
I got a class called NPC, which has a method called goToRoom:
PHP Code:
public function goToRoom(dest:String):Void {
trace(this.name + " going to " + dest);
this.room.unloadNPC(this);
var rm:RoomManager = RoomManager.getInstance();
var r = rm.getRoom(dest);
this.mc = r.loadNPC(this);
this.mc.setArgs(this.name);
}
the room attribute is a reference to an instance of the Room class. the unloadNPC method, clears the npc from the current room it is in atm. With the String dest I load the NPC in the Room with String dest. loadRoom is a method of the Room class, which is printed out below. setArgs is a method of a class called ClickableNPC. This class is a class that makes an instance of the graphical appearance of the NPC class.
PHP Code:
public function loadNPC(npc:NPC):MovieClip {
var mc_ref:MovieClip;
for (var i:Number = 0; i < this.ptNPC.length; i++) {
if (this.ptNPC[i].npcSet == false) {
mc_ref = this.ptNPC[i].attachMovie(npc.getMC(), "npc" + i, this.ptNPC[i].getNextHighestDepth());
trace("loaded cnpc " + npc.getName());
var ref:Object = new Object();
ref.mc = mc_ref;
ref.id = npc.getID();
this.npcArray.push(ref);
this.ptNPC[i].npcSet = true;
npc.setRoom(this);
break;
}
}
return mc_ref;
}
In this method I create a var called mc_ref. I attach a movieclip to this var. The linkage to the movieclip is a movieclip which is registered to the ClickableNPC class. So when I load an NPC its graphical appearence (ClickableNPC instance) is loaded to a point of the ptNPC array. Then I return the ClickableNPC. But here's the issue; the setArgs method, uses the parameter of the last created ClickableNPC to all other ClickableNPC's. other then that the classes work perfectly, all other events and methods of the ClickableNPC work properly. The args parameter is written to a non-static variable of the ClickableNPC class. Anybody has an explination for this strange behavior?
I Have Troubles Wit A Document Class
Hi there.
I have a FLA file where I'm using two frames, in the first one I have just some simple code, but in the second frame I need to use a Document Class because I have a MP3 player that use all the classes in that document.
This document works perfectly when I use only one frame, but when I add a frame before the MP3 player crashes.
If you have any idea, please let me notice.
See you later.
Class Troubles - Sequencer
hi i'm currently trying to create a sequencer class for use with loops
basically the problem is that when the choose loop function is run from the onSoundComplete function it runs, but the _sequence array is undefined and i dont know why
here is my class
Code:
class com.alexpitman.Sequencer extends Array {
private var _sequence:Array;
private var currentLoop:Object;
private var output:Sound;
public function Sequencer() {
_sequence = this;
}
private function chooseLoop() {
var r:Number = Math.floor(Math.random()*_sequence.length);
currentLoop = _sequence[r];
var repeats:Number = currentLoop.rep[Math.floor(Math.random()*currentLoop.rep.length)];
output = new Sound();
output.onSoundComplete = chooseLoop;
output.attachSound(currentLoop.loop);
output.start(0, repeats);
}
public function start():Void {
chooseLoop();
}
}
here is my fla code
Code:
import com.alexpitman.Sequencer;
var s:Sequencer = new Sequencer();
s.push({loop:"loop1", rep:[2, 4]});
s.push({loop:"loop2", rep:[2, 4]});
s.start();
there are two mp3's in the library with loop1 and loop2 export names
i've kind of set it up like the fuse engine
any help?
[F8] Help Please Can A Class Have An Array As A Property? Having Troubles.
Okay, the pertinent information at the start of the class:
PHP Code:
class Ship extends MovieClip {
//private variables
private var _gridsize
private var _gridrow:Number = 0;
private var _gridcol:Number = 0;
private var _health:Number = 9;
//public variables
public var movequeue:Array = Array();
public var beingmoved = false;
public var _facing:Number = 90;
.....
I left in a bunch of the internal variables just so people can see how I was declaring and initializing them.
The problem is with the movequeue property/variable. I have tried declaring it with 'new Array()' at the end as well.
What is happening is that later on in the class file I have method that pushes a value into the moveque. Stripped down, the problem part is:
PHP Code:
private function move1() {
this.movequeue.push("somevalue")
}
In my main code the problem is that after this function call, all my classes of type 'Ship' are assigned the same movequeue.
So if I had ship objects 'playership' and 'playership2', if I did this:
PHP Code:
playership.move1()
trace(playership.movequeue)
trace(playership2.movequeue)
They would both trace "somevalue".
Is my error that you just can't have an array as a property in a class? Because it is a class itself? But a string and a number are classes in AS as well, aren't they?
I am confused and very annoyed.
I was debugging the wrong part of the code for about 2 hours over this issue until I found out that it was the rather simple act of doing the push itself was where the problem was cropping up.
Please help, this is driving me nuts!
Printjob Class Scalability Troubles
Yesterday, I made my first effort in flash printing. The first thing I read about was the functionality of the right click menu and printing. That was easy to have working in no time flat. It prints perfectly. I love the absence of browser defined margins.
But I want to use the PrintJob class, and in no time, I had the code working. But when I hit print (my button), the printout is about 25% wider than what I'd like and no use of pageheight, paperheight, and the like have made any difference.
Code:
PrintButton.onRelease = function() {
var my_pj:PrintJob = new PrintJob();
var myResult:Boolean = my_pj.start();
my_pj.paperHeight = 792 // 11 (inches) x 72 (pixels)
my_pj.paperWidth = 612 // 8 x 72
my_pj.pageHeight = 400 // Movie Height
my_pj.pageWidth = 682 // Movie Width
if(myResult) {
this.visible = false; // hide print button from frame
my_pj.addPage(0); // Adding the sole frame to print
my_pj.send();
}
delete my_pj;
};
I also initially tried it without the paper and page dimension settings. Same result.
External Class Files - Importing Troubles...
I'm working on modifying an open source flash chart (teethgrinder.co.uk) ... I'm having some trouble reaching variables..
The file structure looks like this..
open-source-chart.fla
the only AS is on frame 1 of the timeline and it reads:
import open-source-chart.as
that file doesn't import anything else..
Problem is, it came packages with lots of other AS files... that are mysteriously being imported???
How is this possible???
I'm asking because I'm trying to reach a variable in open-source-chart.as from the file tooltip.as ...
Is that even possible?
Help very much appreciated! Thanks!
Extended Movieclip Class - Moviecliploader Troubles
Greetings:
I've extended the movieclip class, via the library/attachMovie. I'm also loading images
into movieclips on the fly, and need onRollover and onRollout functionality. Here's the
deal: I can access properties and methods of the extended class just fine outside of
the listener.onLoadInit function, but can't access them within:
var mclListener:Object = new Object();
var img_mcl:MovieClipLoader = new MovieClipLoader();
this.attachMovie("extend_mc", "test_mc", this.getNextHighestDepth());
//ExtendMC is the subclass of MovieClip - makes no difference
//to pass target_mc as a MovieClip or an ExtendMC...
mclListener.onLoadInit = function(target_mc:ExtendMC):Void {
target_mc.onRelease = function() {
trace("The on release event worked, however:");
trace("Within the listener, the extended movieclip' test_str property is "+target_mc.test_str);
target_mc.test_fn();
};
};
img_mcl.addListener(mclListener);
img_mcl.loadClip("lemon2.jpg", test_mc);
trace("Outside of the movieclip loader, test_str is "+test_mc.test_str);
test_mc.test_fn();
The class looks like:
class ExtendMC extends MovieClip {
public var test_str:String = "Able to access the test_str property.";
public function test_fn(Void):Void {
trace("Able to access the test_fn property");
}
public function ExtendMC() {
// constructor
}
}
Any ideas about how to make methods and properties of the ExtendMC class
visible within the listener functions?
Thanks
Accessing A Text Box From An External Class In CS3 Troubles.
So I'm going through some tutorials on the site, specifically the MP3 player originally done in Actionscript 2. I've run into a bit of a problem though, I'm trying to update a text field on my stage named pathDisplay.
I have a package with a public class name ZENPlayer from with in my class I have a function that I'm using to move through an array of tracks. I would like to update the text field from with in this same function, but I can't seem to directly access the text field. I get an error 1120: Access of undefined property pathDisplay.
I can set a variable and then call that variable from the main timeline and set the text box text that way but not directly from the AS file is self.
Here's my code:
In my AS file:
Code:
package {
public class ZENPlayer{
import flash.net.URLLoader
import flash.net.URLRequest
public var ZPVolume:uint = 10;
public var ZPTrack:String = "";
public var ZPCurTrack:uint = 0;
public var ZPPath:Array;
public var ZPSongList:Array;
public var ZPSongDisplay:String = "";
public function playSong():void{
ZPSongDisplay = ZPPath[ZPCurTrack];
pathDisplay.text = ZPSongDisplay;
}
//Move to the next MP3 in the list
public function playNext():void{
if(ZPCurTrack == ZPPath.length - 1){
ZPSongDisplay = ZPPath[ZPCurTrack];
pathDisplay.text = ZPSongDisplay;
}else{
ZPCurTrack++;
ZPSongDisplay = ZPPath[ZPCurTrack];
pathDisplay.text = ZPSongDisplay;
}
}
//Move to the previous MP3 in the list
public function playPrev():void{
if(ZPCurTrack == 0){
ZPCurTrack = ZPPath.length - 1;
ZPSongDisplay = ZPPath[ZPCurTrack];
pathDisplay.text = ZPSongDisplay;
}else{
ZPCurTrack--;
ZPSongDisplay = ZPPath[ZPCurTrack];
pathDisplay.text = ZPSongDisplay;
}
}
}
}
My problem is the line:
Code:
pathDisplay.text = ZPSongDisplay;
I know that the ZPSongDisplay is set because I can trace it out.
I have a dynamic text field on the main stage with the instance name pathDisplay but I keep getting the error:
1120: Access of undefined property pathDisplay.
Any ideas?
Thanks,
Steve
Class Question: How To Access Timeline Objects From Class W/o Arguments
Hey all,
I am looking into builiding an application with OO functionality. I understand most of it. Except I cannot figure out how to access something in my app from a class. For instance, lets say I have one Loader class that loads some data and stores it in a variable inside the class (or on the main timeline, doesn't matter). Now, I know I can pass a reference to the data in an argument to another class for that class to manipulate. But if I have several data sources, and other variables and such, that I need to modify in a single class function, how would I do that without having to give the function access to them through arguments? I just want to be able to say, from a class, something like _root.someObject.someFunction();
So, any help would be greatly appreciated, and sorry if that made no sense at all, I tried to explain as best I could.
Happy Holidays!
Dave
[Flash 8] Referencing Class Variables From OnEnterFrame Created Within Class
Hi,
It's been a while since my last post here, but I was hoping someone could help me with a problem I'm having. I want to reference and change a class variable from within an onEnterframe function defined within a class. I can actually do this right now, but I want to do it in a different way. Here's a code sample of what I am talking about:
Test.fla file:
Code:
var t:tester = new tester()
Working tester.as file:
Code:
class tester{
private var num:Number = 100;
function tester(){
var classObj:tester = this;
var mc:MovieClip = _root.createEmptyMovieClip("test",1);
mc.onEnterFrame = function(){
trace(classObj.num); //This traces 100 (CORRECT!!!)
}
}
}
This traces 100 to the output window, just like it should
Here is the way that I would like to do it, because I want to reuse my onEnterFrame Stuff:
Code:
class tester{
private var num:Number = 100;
function tester(){
var classObj:tester = this;
var mc:MovieClip = _root.createEmptyMovieClip("test",1);
mc.onEnterFrame = this.mcOnEnterFrame;
}
private function mcOnEnterFrame(){
trace(num) //this traces undefined (BAD!!!)
}
}
As you can see, the work around to reading the class variable in the onEnterFrame function is to create a reference to the class object, before defining that function, then using the reference you created to access the class variables.
I have tried various iterations to get the second example working, but have had no luck. Does anyone know a way to get the second method working, or am I stuck using the first method.
AS3 Project In FDT + Flex SDK. Root Class Extends Visual Class From Swc
hello
question about compiling as3 project under FDT 3.0 with Flex SDK.
I want my main root class to contain some graphics already at the start. In Flash IDE I put some objects on the stage, make new symbol with all those objects inside, set linkage to MainClassGraphics, export it to swc, add this swc to source folder class-path. Then I write my root class:
Code:
package {
public class MainClass extends MainClassGraphics {
public function MainClass() {
trace('hey');
}
}
}
compiling with flex2 sdk - and I don't see any graphics. why?
if i try this way:
Code:
package {
import flash.display.Sprite;
public class MainClass extends Sprite {
public function MainClass() {
var s:Sprite = new MainClassGraphics();
addChild(s);
trace('hey');
}
}
}
then I see my graphics.. so swc looks like fine
crosspost here http://fdt.powerflasher.com/forum/vi...hp?f=21&t=2268
Accessing A Dynamic Text Field In A Class Other Than The Primary Class
I have tried to read and understand some of the other threads for this issue but, I think it would be easier to understand if I show my specific issue. I left some code out to make my issue more clear.
Alpha is the primary class with access to the stage. If I write the event listener and function contained in the Bravo function into the Alpha function it works. Although, I want it to be in a different class in the same package (such as the Bravo class).
I have created a instance of a class which is a physical object on the stage (lets say it's a card). The event listener is in the instance so that each instance has a self contained listener.
The bottom line is it works in the primary class but in no others. How can I make it access the text field (so when I click on the "card" the text field shows "something"?
ActionScript Code:
package a {
public class Alpha {
public function Alpha() {
x:Bravo = new Bravo();
}
}
}
package a {
public class Bravo {
public function Bravo() {
this.addEventListener(MouseEvent:CLICK, clickEvt);
function clickEvt(event:MouseEvent) {
<MovieClip>.<MovieClip>.<DynamicTextField>.text = "something";
}
}
}
}
Calling SetTimeout Within Custom Class And Cannot Access The Class' Variables
Hi All,
I'm creating an user interface with Flash 8, I'm new to Flash, my background is Java therefore I decided to use ActionScript to create a custom component that is reference within an external file.
My problem I believe is scope related. I have a status bar (label component), once I update the status bar I want to call the
"setTimeout" function to wait a couple of seconds before clearing my status bar. The "setTimeout" function is executing, but for some reason my status bar is not being cleared (accessed).
Below is a snippet of my code. Any help appreciated. Thanks.
/*
External File
*/
import mx.controls.Button;
import mx.controls.Label;
class MyApp
{
//private properties
private var mc_container:MovieClip;
private var btn:Button;
private var lbl_status:Label;
private var str:String = "do see me";
//constructor
public function MyApp(target:MovieClip)
{
trace("-- MyApp --");
mc_container = target.createEmptyMovieClip("mc_container", 100);
}
//public methods
public function init(width:Number, height: Number, xPos:Number, yPos:Number):Void
{
var my_app:MyApp = this;
btn = mc_container.createClassObject(Button, "btn", 1, {label:"click me"});
btn.setSize(100, 25);
btn.move(10, 10);
btn.clickHandler = function():Void
{
trace("btn clicked");
setTimeout(my_app.clearStatus, 2400);
//correct if I call directly
//my_app.clearStatus();
trace(str);
}
lbl_status = mc_container.createClassObject(Label, "lbl_status", 2, {text:"status bar message"});
lbl_status.setSize(200, 25);
lbl_status.move(0, 50);
}
public function clearStatus():Void
{
trace("calling clearStatus");
lbl_status.text = "";
}
}
/*
Called for Flash IDE
*/
var app:MyApp = new MyApp(this);
app.init(200, 200, 0, 0);
ActionScript 2.0 Class Scripts May Only Define Class Or Interface Constructs.
This is driving me nuts. I have an old AS1 project which I upgraded to AS2. It uses an include file, settings.as, which has stuff like this:
settings = new Object();
settings.property = 'some value';
Then I include it on the main timeline like this:
#include "settings.as"
Every time I render, I get a million and one Compile Errors stating:
"ActionScript 2.0 class scripts may only define class or interface constructs."
But it isn't an ActionScript 2.0 class! It's just a regular include. How do I avoid the bogus Compile Errors?
AddChild Works With Document Class, But Not Timeline-instantiated Class
I cannot get a sprite to display for me when I create an instance of a very simple class in my FLA file's timeline.
However, when I make the class file the FLA's document class file, it displays just fine.
The task in question is simply drawing a square with the shape class.
Problem example:
My class, Test.as, resides in the same folder as my FLA file - so I don't use any import statement. I'm new to lots of CS3 stuff. Can anyone tell me why this doesn't work and create the shape on the stage? This seems to fail silently without any errors:
var myTest:Test = new Test();
Working example:
Setting the document class to Test.
Attach Code
// Test class
package {
import flash.display.*;
public class Test extends Sprite {
public function Test():void{
doThing();
}
private function doThing():void{
var myRect:Shape = new Shape();
myRect.graphics.lineStyle (2, 0xcc0000, 1);
myRect.graphics.beginFill(0xcccccc, 1);
myRect.graphics.drawRect(10, 10, 200, 200);
addChild(myRect);
}
}
}
[AS3] Making An Auto-generated Class Inherit From Custom Class?
hi, just wondering if this is possible
i was hoping to find a way to get a bunch of objects in my library to inherit from (or even be) one class that i have made, but without having to make .as files for every single one
is this possible, or is there any other way to give objects another classes functionality in an auto-generated class?
cheers
MC Troubles
I have a few questions:
1) I have 3 MC's and 3 corresponding buttons. On the rollover of button "1" MC "1" needs to play(the trick is I want it to play to it's end no matter what else happens {rollout/release} then complete it's task ie goTo URL) this is the code I have for that as of now (tried many others but to no avail)
on (rollOver) {
gotoAndPlay ("left");
}
I was also advised to try:
on (rollOver) {
gotoAndPlay ("left");
if (left._currentFrame) {
play ();
}
}
2) Then at the end of the MC I want it to return to frame 1 on the main stage?
PHP Troubles
Ok, this is a bit of a weird problem. I'm useless at coding anyway, so you can imagine how I fare with PHP. However, I got both a 'mailing list' type thing as well as a 'comments' form working absolutely no problem. That is when tested offline in the stand alone flash player.
When I publish the file online the PHP wouldn't work for some reason. I have this code on the first frame:
Quote:
mailform = "http://www.domain.com/mailform.php";
action = "";
an input text box assigned the instance name 'vemail' and this code on a 'submit' button:
Quote:
on (release, keyPress "<Enter>") {
if ((vemail.indexOf("@") != -1) && (vemail.indexOf(".") != -1) && (length(vemail)>5)) {
action = "Send";
loadVariablesNum("http://www.domain.com/mailform.php", 0, "POST");
vemail = "";
getURL("java script:NewWindow=window.open('http://www.domain.com/success. htm','newwin','width=240,height=200,top=0,toolbar=
No,location=No,scrollbars=No,status=No,resizable=N
o,fullscreen=No'); NewWindow.focus(); void(0);");
} else {
vemail = "incorrect entry!";
action = "";
stop();
}
}
This is the PHP script as well:
Quote:
<?
$adminaddress = "email";
$siteaddress ="http://www.domain.com";
$sitename = "site";
$date = date("m/d/Y H:i:s");
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
IF ($action != ""):
mail("$adminaddress","subject",
"new member: $vemail
Logged Info :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","FROM:$adminaddress");
mail("$vemail","thank you for visiting $sitename!", "Hi $fname
Blah Blah Blah
$sitename
$siteaddress","FROM:$adminaddress");
ENDIF;
?>
Like I said, I am pretty awful at coding but this seemed to work when I was offline, so I can't work out why it doesn't work online. Presumably there is no problem with the server that the PHP file is uploaded to seeing as though it worked before.
Can anyone help?
telekin:
SWF To AVI Troubles...
I'm a TOTAL newb, so I hope I'm just not doing something right...
I'm trying to convert the SWF files from this page into AVI files so I can burn them onto a video CD or a DVD.
My problem is that no matter what program I try, when I export the movie, it does NOT save the sound at all...
Anyone know what I may be doing wrong???
Is there a program that will convert the file for me in whole???
Thank you very much for your time.
-EB64
SWF To AVI... Troubles... Help... Please...
Hey, I've got this problem, see if you can give me a hand.
I made an animation in Flash, that has several movie clips, with other movie clips inside, and so on (I'll explain better so you can understand: they're some animals that move, and their eyes (that blink) are another movie clips inside of the first movie clip). When I publish it as an .SWF, it works as expected, but if I export it as an .AVI (the animation will come out in video, and the person that's going to edit it asked me for that specific format), the movie clips don't move, like it is only reading the main timeline. Do you understand me? The only movements that come out are the ones that happen in the main timeline. The others movie clips stay still in the first frame. oes anybody know what's going wrong and how can I export that .AVI? Thank you.
Dns Causes Troubles?
Hi
In this site I made, there is a popup function that's allow to see
pictures. When I click on the buttons, it tries to open a new page
but not a popup.
Since I applied a dns management package and cloaked the site's name, that function doesn't work anymore( and it used to ).
The pictiures are in a file that's on the same level that the only
.fla wich contains the all site.
function popCenter (url, nom, largeur, hauteur) {
getURL ("java script:window.open('http://www.webcold.com/MahalR" +url +"','" +nom +"','width=" +largeur +",height=" +hauteur +"scrollbar=yes,top='+((screen.height/2)-(" +hauteur/2 +"))+',left='+((screen.width/2)-(" +largeur/2 +"))); void(0);");
}
On the buttons itself:
on (release){
_root.popCenter("popup/IMG_1393.html", "gpopup", "410", "307");
}
If you want to have a look, go http://www.mahalrayan.com ,in the photogallery section and click on the pictures.
Dns Causes Troubles
Hi
In this site I made, there is a popup function that's allow to see
pictures. When I click on the buttons, it tries to open a new page
but not a popup.
Since I applied a dns management package and cloaked the site's name, that function doesn't work anymore( and it used to ).
The pictiures are in a file that's on the same level that the only
.fla wich contains the all site.
function popCenter (url, nom, largeur, hauteur) {
getURL ("java script:window.open('http://www.webcold.com/MahalR" +url +"','" +nom +"','width=" +largeur +",height=" +hauteur +"scrollbar=yes,top='+((screen.height/2)-(" +hauteur/2 +"))+',left='+((screen.width/2)-(" +largeur/2 +"))); void(0);");
}
On the buttons itself:
on (release){
_root.popCenter("popup/IMG_1393.html", "gpopup", "410", "307");
}
If you want to have a look, go http://www.mahalrayan.com ,in the photogallery section and click on the pictures.
Mac Os + MX Troubles
Hi ,
I’ve been downloading tons of movies from the flash archive, i was looking for some kind of nice, simple mouse follow but with flash MX i am not able to open any .fla .
I am using Mac os 9.01 on a G3 eand it gives me ERROR -39.
I also try to change the Type of file with ResEdit, the icon change but i got always the same message. -39.
Any mac user got any clue ?
thanks!
Pop Up Troubles
Okay, so I have this flash site I'm making for school. The main site loads into a pop up window that I made with this javascript that I put into a welcome page:
SCRIPT LANGUAGE="JavaScript"
function popup() {window.open('intro.html','','toolbar=no,location= no,directories=no,status=no,menubar=no,scrollbars= no,resizable=no,width=504,height=360,left=0,top=0' );}</script>
It was originally working okay, but I made some changes and republished the pop up html and swf files. Now the pop up window opens okay, but the flash movie is shifted to the bottom right, cutting off some of the movie. I tried placing the flash movie in differant places within the html file ie.Top, Absalute middle etc. but nothing has worked.
Thanks.
MC Troubles
Hi Dudes & Dudettes!
I am hoping that one of you flash bods can help me out with this MC problem that I can't get my head around!?
I have a movie that I am working and in theory it should be quite simple. I have a MC(screen) of a display screen that part-rotates on a timeline of 100 frames (24fps) frame 1 shows a 3/4 left side on view of the screen - frame 50 shows a flat front on view - and frame 100 shows a 3/4 right side on view. This movie clip is then put into another timeline on a 750width stage where the MC-Screen starts on the far left hand side of the stage and moves to the exact centre on frame 50 and finishes on the far right of the stage on frame 100 all positions on the stage correspond to the rotation amount in the MC-screen.
What I want to do is have 10 screens placed at intervals across the stage and want the MC-screen to start playing from different frames of the MC-screen ie: the first screen plays from frame 1 of it's timeline then the next screen will always play from frame 10 etc... so it gives the effect of continuous movement by the screens. I have tried to duplicate the MC-screen and then paste the first 10 frames at the end of the timeline for the MC-screen so as frame 10 becomes frame 1 but it seems to eat the memory up.
How do I do it??? someone out there must have some idea......
......please!!!!
Cheers
Diga
Mc Troubles
Hi Dudes & Dudettes!
I am hoping that one of you flash bods can help me out with this MC problem that I can't get my head around!?
I have a movie that I am working and in theory it should be quite simple. I have a MC(screen) of a display screen that part-rotates on a timeline of 100 frames (24fps) frame 1 shows a 3/4 left side on view of the screen - frame 50 shows a flat front on view - and frame 100 shows a 3/4 right side on view. This movie clip is then put into another timeline on a 750width stage where the MC-Screen starts on the far left hand side of the stage and moves to the exact centre on frame 50 and finishes on the far right of the stage on frame 100 all positions on the stage correspond to the rotation amount in the MC-screen.
What I want to do is have 10 screens placed at intervals across the stage and want the MC-screen to start playing from different frames of the MC-screen ie: the first screen plays from frame 1 of it's timeline then the next screen will always play from frame 10 etc... so it gives the effect of continuous movement by the screens. I have tried to duplicate the MC-screen and then paste the first 10 frames at the end of the timeline for the MC-screen so as frame 10 becomes frame 1 but it seems to eat the memory up.
How do I do it??? someone out there must have some idea......
......please!!!!
Cheers
Diga
{Mod Edit: Moved to General Help- SJT]
For (i=1; I<17; I++) Troubles
Here is some code I'm writing that I'm having some big problems with. First, for the "text1" variable on line 7, how do I write the "unescape(title1)" part so that it goes: title1, title2, title3, etc.? Second, even bigger problem; all of my variables in this act like they are all 17, not 1,2,3,4,5,6 etc. Finally, how do I handle changing info like "rocksDescription" mindway down the code and, "QS164_Rocks.jpg" at the bottom?
Code:
title1 = "Rocks%99"
title2 = "Eggs%99"
title3 = "Cars%99"
//etc.
for (i=1; i<17; i++) {
_root["Btn"+i].btn.onRollOver = function() {
text1 = unescape(title1);
};
_root["Btn"+i].btn.onRollOut = function() {
text1 = "";
};
_root["Btn"+i].btn.onRelease = function() {
_root.attachMovie("ButtonCoverMC", "ButtonCoverMC", 80);
_root["Btn"+i].gotoAndStop(2);
setProperty("_root.ButtonCoverMC", _x, i*23+209);
setProperty("_root.ButtonCoverMC", _y, 470);
_root.ButtonCoverMC.coverText = i;
_root.Description.copy.attachMovie("rocksDescription", "", 2);
_root.Description.gotoAndPlay(2);
_root.attachMovie("ProductFadeInMC", "ProductFadeInMC", 300);
setProperty("_root.ProductFadeInMC", _x, 202);
setProperty("_root.ProductFadeInMC", _y, 189);
loadMovie("products/QS164_Rocks.jpg", "_root.ProductFadeInMC.productHolder");
};
};
text 1
XML Troubles, Please Help
Hey all;
I'm having troubles getting my xml data to display correctly, any suggestions?
Here's what I've got so far:
- An MC with a scrollpane on the stage.
-In the library, a MC called contentMC.
-Inside contentMC is an empty MC called imgHolder (for holding the jpgs) and a dynamic text field named infoText.
-An XML file named catalog.xml.
So I've been able to adjust my xml nodes to get to my info, but it wont display right. For one thing, it won't display the jpgs unless there is a dynamic text field in contentMC (which I find wierd). And secondly, I can't figure out how to position the jpgs & text so they don't overlap each other.
Here is the code I've got loading in the xml:
Code:
//create new XML object & load from external source
albumXML = new XML();
xmlDoc = "catalog.xml";
albumXML.ignoreWhite = true;
albumXML.onLoad = checkXMLStatus;
albumXML.load (xmlDoc);
//Checks the success of the loading
function checkXMLStatus(success) {
if (success) {
//Build the catalog
buildMenu();
} else {
trace (" Did not load ");
}
}
stop();
and this is the code I've got manipulating the xml data:
Code:
function buildMenu() {
theDepth = 100;
this.createEmptyMovieClip ("con", 10);
nodeCount=albumXML.firstChild.firstChild.childNodes.length;
for (u = 0; u < nodeCount; u++) {
//Build the content listing
buildContent();
} //Attaches the clip of items, to the Macromedia scrollpane component, which has an instance name of "catalogPane".
albumPane.setScrollContent (con);
}
function buildContent(){
theJpg = albumXML.firstChild.firstChild.childNodes[u].attributes;
theInfo = albumXML.firstChild.firstChild.childNodes[u].childNodes;
theName = "item_" + u;
con.attachMovie("contentMC", theName, theDepth++, {_y :350 * spacing});
con[theName].imgHolder.loadMovie(theJpg);
con[theName].infoText.text = theInfo;
spacing++;
}
stop();
...and this is the XML data:
Code:
<catalog>
<albums directory="albums">
<imageNode jpegURL="alb01_img00.jpg">Description of album 1</imageNode>
<imageNode jpegURL="alb01_img01.jpg">Description of album 2</imageNode>
<imageNode jpegURL="alb01_img00.jpg">Description of album 3</imageNode>
<imageNode jpegURL="alb01_img01.jpg">Description of album 4</imageNode>
</albums>
<singles directory="singles">
</singles>
<videos directory="videos">
</videos>
</catalog>
So how do I get the text to display correctly? Right now I get the word "null" in the text box when I test.
And how do I get it all to line up correctly?
Thanks for any and all help.
A Few Troubles
1) I want a projector file to open in Full Screen, so it doesn't show the Flash file menu or title bar. How do I do this?
2) I want to have a print function inside the projector so I don't have to use Flash Player's File->Print, and so I have control over what is being printed. Could someone please link me to a relevant tutorial?
3) When I set the Alpha of a movie clip to 0, if the movie clip has other movie clips inside of it then they are not made invisible. Do I have to set all of the inside objects to be invisible, one by one, or is there another way?
Thanks
XML Troubles. Its A Bit [U]ODD[/U]
Hi Everybody, Im Using Flash to read Questions from an XML file. The trouble Im having is, I am reading questions from an XML file into Flash variables, but the questions only load into the variables if the nodes are odd numbers!!! Ive got it working with the odd numbers, what I was wondering if anybody new why this happens and if possible how to fix it?.
Troubles With 3D
I am as as
I'm a real newby, as you should be in this forum. I've got this download, Swift 3D, I Think, at least something with 3D. My problem:
How to attach, for example, spinning wheels to a car, wiggly eyes to a face, that sort of thing.
Please answer this one question, I soy to anyone who knows this stuff( or is it only allowed for newbies to answer here? )
If someone reacts, THANK YOU
Troubles With This
trying to do something fairly simple, just want to have a root function define onRollOver,onRollOut, and onEnterFrame for a bunch of movieclips
PHP Code:
//frame actions in root
function prepare() {
this.onRollOver = function() {
if (this._currentframe<this._totalframes) {
this.go = true;
}
_root.popup("TV", this);
};
this.onRollOut = function() {
this.go = false;
_root["mytext"].removeTextField();
_root.popupmc.removeMovieClip();
_root.pointer.removeMovieClip();
};
this.onEnterFrame = function() {
this.go ? play() : prevFrame();
};
}
PHP Code:
//actions in mc
onClipEvent(load){
_root.prepare(this);
}
Pop-up Troubles...
i've tried to make a site that has a main page which has a button on it that will launch the actual website, in its own window. I had it working but i accidently deleted the fla file of my working version, and now that i have had to redo it i cant seem to get it to work again! So i was wondering whats wrong with my code? :
on (release) {
getURL ("javascript:NewWindow=window.open('http://www.geocities.com/flashsaga/testsize.html','Welcome To Flashsaga','width=985,height=580,left=15,top=50,to olbar=No,location=No,scrollbars=No,status=No,resiz able=No,fullscreen=No');", "NewWindow.focus(); void(0);");
}
incase you want to see what that code ends up doing you can find it here:
http://www.geocities.com/flashsaga/main.html
IF Troubles
I have a large if statement being worked through. This is the part that is causing the trouble.
(this is one section of a much longer code)
code:
} else if (variablea == 5 or 6 && variableb == 2002 && variablec == 49 && variabled == 1 or 4 or 5 or 6) {
variablef = blah1;
} else if (variablea == 5 or 6 && variableb == 2002 && variablec == 49 && variabled == 2 or 3) {
variablef = blah2;
}
Now, no matter what I enter for variablec or variabled I always end up with variablef becoming blah1.
variablef should become blah2 if variabled is 3 or 4.
Hope this doesn't sound too confusing.
Pop Up Troubles
I am having troubles where some of my pop ups have stopped working. Instead of the pic appearing in a new window at the specified size, the new window just says 'untitled' and is regular size. I have this code on the button:
Quote:
on (release) {
getURL("javascript: MM_openBrWindow('brace1.html','loading','width=300 ,height=450')", "_blank");
}
Is there any hidden code in the html file/s that I may have overwritten, or can you think of any other reason why they are all not working?
Pop-up Troubles
hi everyone. I'm having trouble with some pop-ups. THey work fine on firefox but wont pop in IE6, is there anything else i could add to the code to make it pop in IE?
i used the same code in this tut.
http://www.kirupa.com/developer/flas...pup_window.htm
please help
Im using flash 8
[F8] Lag Troubles
Hey everyone!
I am almost done with my game, you can view the beta version here http://peejaroni.com/drawman.aspx
As you can see if you play for a while you will experience a bunch of lag. I'm not going to post the .fla in case someone tries to steal it, but I will post the script I think it is lagging at. I believe that the missiles keep duplicating, and the for loops that detect hitTests end up working too hard when they need to calculate over 150 numbers. I tried to clear out the numbers every X amount of shots, but then the hitTests wouldn't work at all.
here is my duplication code...
_root.z --
_root.j++;
duplicateMovieClip("_root.rline", "rline"+_root.j, _root.z);
eval("_root.rline"+_root.j)._x = heroman._x;
eval("_root.rline"+_root.j)._y = heroman._y;
Here is my hitTest code
for (o=1; o<=_root.j; o++) {
if (this.hitTest(eval("_root.rline"+o))) {
if (eval("_root.rline"+o)._currentframe != 1) {
this.gotoAndPlay(2);
if(_root.ten == true){
_root.refy = true}
}
}
}
Thanks for your help.
ps. if you find any other bugs or problems or comments in the game please post them too.
Swf Troubles
I am making a game, everytime I export the game to an swf the controlls such as enter and arrow keys dont work. But then does work when I use the test movie funtion in my flash animator. Anyone know what to do, or how to make it work.
XML Troubles
Hello there,
i'm trying to make a photo gallery using kirupa tutorial http://www.kirupa.com/developer/mx2004/thumbnails.htm, but i tried to make this gallery with categories, so i made XML file like this
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<gallery>
<galleryName id = "Schools">
<images>
<pic>
<image>images/1.jpg</image>
<description>Hello</description>
<thumbnail>thumb/1.jpg</thumbnail>
</pic>
<pic>
<image>images/2.jpg</image>
<description>Hi</description>
<thumbnail>thumb/2.jpg</thumbnail>
</pic>
<pic>
<image>images/3.jpg</image>
<description>Hey</description>
<thumbnail>thumb/3.jpg</thumbnail>
</pic>
</images>
</galleryName>
</gallery>
and traced galleryname
Code:
galleryName= xmlNode.childNodes[i].attributes.id;
but when i trace image using this code in flash
Code:
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
it gives me null!!
Can you have a look?
Thanks!
Xml Troubles
i've been working with xml and i have also problems with it!!! i'm a beginner with this language...
i just don't understand and don't know how to import to flash special characters such as "ç" "á" "ã"... can anyone tell how can i import to flash this characters???
thanks for helping me
jinhos
Var Troubles
hey guys, so heres the scenerio:
Initially get the y positoion of _root.whiteBox.topTitles.titles.panel and store it in an variable called
titleY.
Then when each button is rolled off it will return to the titleY position. Either the one set at the start of the movie or when one of the buttons is pressed.
When each button is pressed it will set the titleY varible to a new number defined in the on (release) action. e.g: titleY = 140;
This is what I want to do, but what seems to be happening is something...I really don't know, I'm still kinda new and this stuff.
Mpg Troubles
Why is that when I import an mpg movie and make sure the "import sound" is checked, the audio on the mpg still does not work?? I have tried every import variation and nothing works.
MC Within An MC Troubles
When the game starts the MC playScreen displays because a variable is at 0. The playScreen MC consists of two other Movieclips, one Graphic background and one play button called playBTN.
Once you hit the playBTN a loop is executed to fill the monOnScreen variable (the one that was at 0 before) to the level*5 (so 5 would be the max at the first level). The monOnScreen represents the number of enemies on the screen. When you hit an enemy it subtracts from the monOnScreen variable.
When the monOnScreen variable reaches 0 what is supposed to happen is that it will turn on the playScreen variable so that you can press play and start a new level. I'm using a movieclip's .onEnterFrame to constantly be checking the monOnScreen variable.
The problem with this is that when it comes up after the first time the play button won't work. The first time it loads, it works perfectly but the second time it doesn't work. I've tried checking the monOnScreen variable every time you hit an enemy but still the same result (the play button not working).
Here's what I've written.
ActionScript Code:
//Play Button
playScreen.playBTN.onRelease = function() {
trace("The Play Button is working");
//It needs to create the monsters
for (a=0; a<=level*5; a++) {
duplicateMovieClip(_root.enemy_mc, "enemy"+a, monDepth);
setProperty("enemy"+a, _x, 580);
setProperty("enemy"+a, _y, Math.round(Math.random()*300)+10);
_root.monOnScreen++;
_root.monDepth++;
playScreen.gotoAndStop("off");
trace("A is "+a);
}
};
//Checking to see if there are any monsters left
thing_mc.onEnterFrame=function(){
if (_root.monOnScreen == 0) {
//There are no monsters so start up a new level
_root.level++;
trace("The new level is "+_root.level);
_root.playScreen.gotoAndStop("active");
} else {
//Do nothing
}
}
Everything is named correctly (I know this because it works when it first comes up) it's just that the play Button doesn't work the second time it pops up.
Anyone have any ideas?
|