ActionScript 3.0 :: OOP Sending Info From One Class To Another?
Sep 10, 2010
i have backdoor ways of getting info from other classes, but they seem to be far too long. So I am trying to do something different.. Imagine two entirely separate classes. The classes only extend MovieClip, and don't know about one another. What is the best way for them to know of eachother, without extending one another.
I thought it was interfaces, so I made an interface, and tried to send information from classA to classB within the interface. So, I had classA set the implemented interface variable to "21" and was trying to get that information on from classB, by implementing the same interface, and rather than setting, classB is getting. It didn't work. Where am I going wrong? Do I not need to use an interface?
View 3 Replies
Similar Posts:
Sep 4, 2011
I need to create a scoreboard for my game. I want to be able to let my user submit the time it took to complete the game to my scoreboard. I have been able to purchase webspace with SQL, PHP. I have set up my SQL database. I have found a great tutorial about how to do precisely what I wanted on YouTube BUT after starting the tutorial I realised it was ActionScript 2, I REALLY need time type of tutorial but for ACTIONSCRIPT.
View 2 Replies
Jan 28, 2012
A website is changing its payment processor company to authorize.net and they sent code to the client that's to be embedded in an html page:
Code: Select all<form name="PrePage" method = "post" action =
"https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx">
<input type = "hidden" name = "LinkId" value
[code].....
View 3 Replies
Jan 19, 2004
I am using loadVars with the send method to send my contact info to a php file. This works fine but when I press the submit button the browser goes to the email.php file. How do i prevent it from opening that file in the browser window?
Heres the [AS]
lv = new LoadVars();
lv.name = name;
lv.company = company;
lv.phone = phone;
lv.email = email;
lv.message = message;
lv.send("email.php", "POST");
}
[/AS]
View 2 Replies
Feb 22, 2011
We have a sort of game, generated with Flash in AS3, on our website where the reader is invited to eliminate the California Budget Deficit. It's connected to a database where we keep track of the responses and print them in chart form and post the results on the website so everyone can see the most popular budget items the readers want to cut.
See the interactive in question here:
[URL]
We've had many, many requests to have an option where the reader can get a copy of his/her choices that he/she can print out. I've thought about having a movieclip pop up that shows those choices (and that would be simple enough), but in addition to that, what I'd really like to do is have a way to download those choices to the reader's computer as a text file or maybe have a "Print" button on the movieclip showing the choices that would print just that movieclip. The database we have wouldn't really be suitable because it's set up to simply show which were chosen and which not, and the names of the submissions and choices are variables that don't really mean anything except to us when we put it all in an excel file.
View 1 Replies
Oct 31, 2010
From the main class I call a function from another class and give it 20 variables to work with. That class does the math and gives me the 4 variables I need but how do I have the main class read these? Do I use a return function or getters and setters?
[Code]...
View 5 Replies
Nov 10, 2009
I'm trying to use a custom class to create a mosaic type of gallery, and load jpegs in which some may have different dimensions. I'm using the Loader Class and I can get the content width value of the jpegs I'm loading, but I'm having trouble adding that value to the property of the (custom) object. Here is the Class:
package {
import flash.display.*;
import flash.events.*;
[code].....
View 0 Replies
Sep 2, 2009
I have a movieclip in a library with a class name: menuItemMC
now I want to send this to another class:
var myClass:CustomClass = new CustomClass(menuItemMC);
and then in that class I need to use this like:
//contructor
public function CustomClass (menuItem:* );
var customID:menuItem;
customID = new menuItem();
I tried something like this, but its not working...how do I receive this and use it from there?
View 5 Replies
Jun 24, 2010
I have some scrolling content (info). I've also made my own scroll bar.I want the scrollBar dragger to be positioned in relation to the info._y as the user scrolls info.I have created two vars: one that worsk out where info._y is as a percentage and the other that works out where the scroll._y dragger should be as a percentage...
Actionscript Code:
var scrollBarPercent = Math.round(scrollBar.dragger._y / [code]........
also onMouseWheel working too.I need a small bit of code that takes the % of info._y and moves the scrollBar dragger to the same % but in relation to the Stage.height...so if projectGalleryPercent = 50%, make dragger._y 50% of Stage.height using scrollBarPercent.
View 1 Replies
Jan 8, 2010
I am building an APP and have a movieclip(loginScreen_mc) on stage which has a linked class. This class (login class) recieves some xml data and then tells the parent swf (parent.loginScreen_mc) to goto next frame which has a movieClip on it and yes this movieclip has a linked class (case class).
how do i send the xml data recieved in the login class to the case class. I tried to send it to the case class's constructor fn but it doesnt like that.
View 5 Replies
Oct 11, 2009
I have two classes one called 'LoaderSwf.as' which is used to talk to all the other classes im using. I also have a 'GeneralTimer.as' which works fine from a stand alone 'GeneralTimer.swf' file. What I am trying to do is send a value of 10ms to the 'GeneralTimer.as' which will then run the timer and when complete send a value back. But for simplicity im trying to send a 10 ms value to trace("tick") and trace("tock").
I keep getting error "TypeError: Error #1034: Type Coercion failed: Cannot convert 10 to GeneralTimer." this is according to Adobe "1034 Variables cannot be native." What does that mean for starters?
Here's my code:
in LoaderSwf.as
Code:
var w:Number = 10;
GeneralTimer(w);
in GeneralTimer.as
[Code].....
so as you can see I want to send the number 10 to be used in the GeneralTimer. I am sure I have used this before (in CS3) and its worked but am now using CS4
View 4 Replies
Jul 20, 2009
I have two files, one is Slideshow.as which loads the XML which justs traces out the content. However when I try and load this class from an .fla file I received the following error:
ArgumentError: Error #1063: Argument count mismatch on Slideshow(). Expected 1, got 0.
In my FLA the document class is set to Slideshow with Slideshow("slideshow.xml"); on the first frame.
Here is my Slideshow.as file:
Code: Select allpackage
{
import flash.display.MovieClip;
import flash.events.Event;
[Code]....
I don't quite understand why I am receiving the error. I'm used to writing AS straight into a frame of an FLA however I decided to attempt to write a class file.
View 1 Replies
Oct 11, 2009
I have two classes one called 'LoaderSwf.as' which is used to talk to all the other classes im using. I also have a 'GeneralTimer.as' which works fine from a stand alone GeneralTimer.swf' file. What I am trying to do is send a value of 10ms to the GeneralTimer.as' which will then run the timer and when complete send a value back. But for simplicity im trying to send a ms value to trace("tick") and trace("tock").I keep getting error "TypeError: Error #1034: Type Coercion failed: Cannot convert 10 to GeneralTimer." this is according to Adobe "1034 Variables cannot be native." What does that mean for starters?Here's my code:in LoaderSwf.as
Code:
var w:Number = 10;
GeneralTimer(w);
[code]....
View 3 Replies
May 31, 2011
I want to find out whether my swf was loaded locally or from another swf. For this purpose I have declared a variable 'parentType' in my fla. var parentType:String = String(parent); There is a function in the document class that determines whether swf was loaded locally or from another swf. The name of the function in the document class is 'externalOrInternal'. The varaible parentType is passed as a parameter to the function externalOrInternal externalOrInternal(parentType); The name of the document class is Main. In the constructor of Main I have the function pollResize() (the use of this function is to listen for the resizing event. That part of the code is not shown in the snippet given below).
[Code]...
I see that swfParentType is has value insde the function externalOrInternal. My doubt is why null is traced inside the function pollResize. Why is it not [object Stage] as inside externalOrInternal. Due to this I am not able proceed further with the stage resizing event.What needs to be done so that proper value is traced in the function pollResize.
View 1 Replies
Apr 14, 2011
I'm creating a little game - The player controls a character that follows the mouse. Pigs run away from the player, and the player has to get them all into a pen. To make the game a little more difficult I'm trying to add an enemy - wolves, that attempt to perform a 'hunt' method every x seconds. This method sends a reference of the wolf instance to Main (my document class) and Main then loops through the pigs on stage to see if there's any nearby. Now as far as I know this works - my problem is I'm unsure how to send the pig instance reference back to the wolf that called the hunt method, so it can then 'target' the pig, and then attempt to pounce on it.
This is my Wolf class:
Code:
package
{
import flash.display.MovieClip;
import flash.events.Event;
[Code].....
View 7 Replies
Sep 22, 2009
I'm now finding the great need for classes as my current project is getting quite gummed up with too much scripting in the main document. Becoming a real pain to find stuff with in my code.
So I started writing a class to takes an id passed to it from the main time line, accesses my mySql DB, pulls the related info and the processes it. What I can't seem to figure out, is how to pass a variable back to the main time line. The traces all work, so I know my class works. I've searched here and via google, but I must not be searching the right stuff because I get a lot of results with are usually very complicated questions that don't yield the answers I need.
so here we go. my main.fla (and question):
Code:
import Name;
var theUserName:String = "Joe";
var processName:Name = new Name(theUserName);
[Code]....
ps: what's it called when trying to call a method from the main time line? or passing a property back to the main? are there specific terms for these?
View 10 Replies
Dec 20, 2006
I loaded a swf in another swf. Lets say in.swf is loaded in all.swf. But I need to pass some info from a movie clip inside of in.swf to another movie clip inside of all.swf.
View 10 Replies
Sep 23, 2009
Is it possible for a swf to get info from an XML file that is placed in a different domain? And if it is, how can I do it?
View 3 Replies
Oct 15, 2009
I need to make a projects that when a section is rolled over a info box appears. It is similar if not exactly like the link below.I have a solid basic working knowledge of flash and actionscript. Been working with Flash for few years, but it has all been basic work, nothing too complex.
View 1 Replies
Apr 2, 2010
I am using Adobe Flash Media Streaming Server 3.5 but I can't find any output file (fx a xml file) that I can pull out info from and use on my website via a PHP or ASP script. It could be nice - in the website - to retrieve info like "online users attending", "running / streaming state" (online or offline) and other relevant info about the streaming, so I on the website can display how many that are online when a webtv event is streaming.
View 19 Replies
Apr 6, 2011
In FlashBuilder's compiler options (Properties->Flex Compiler), under "Adobe Flash Player options" there is an option for "Use a specific version", where you can tell it what Flash Player to link against:
How do I get this value at runtime? Note that I am not talking about the Flash Player version, but the version that the swf was linked against.
View 4 Replies
Oct 3, 2009
Do anyone have any idea how to get a hardware information (like processor id) of the machine that the AIR application is running on?
I need to verify if my app is ran on the specified computer and than allow or deny data access.
View 2 Replies
Nov 30, 2009
I'm working with a php script that takes a really long time to process. Is it possible to get the process info to flash (as3)? I'm thinking that I could echo the process percent from php, but is it possible to read and use the values as the process is running
View 1 Replies
Oct 23, 2010
I would like to know if theres anyway to get the computer name or some other unique computer information to make a computer unique and I save that info in my database.
if someone know how to exhibit the Computer Name
View 5 Replies
Feb 3, 2009
Example:Lets imagine a html page with 2 swf embed inside. First swf has some UI, and second swf loads content.Is there a way to pass events or variables from the first swf to trigger stuff on the second? If yes, how?I would love to know the simplest way to achieve this.P.s- From what i understood from Lee's tuturial on swfObj, i can pass vars from html to the swf (using flashvars). Is there a way to pass from the swf to the html in a similar fashion?
View 7 Replies
Feb 6, 2005
I have a news page that I update with my stories. The info goes to a read.asp page that displays my info. I need to get the stories into a flash text field or box (anything really) so I can have the same news stories post. I can upload the file so you could look at it and tell me how to call the stories into flash.
View 1 Replies
Dec 20, 2010
I have a flash as2 file which loads pictures into a thumbnail slider through an external xml file. when i try it out in my pc it works, images load perfectly and i can view the thumbnails, but when i contain the flash in a php and upload it, it stops working, the images never load.i guess flash has an issue trying to pass the xml info through php, i tried searching for compatibility issues but couldn't find anything concrete...
View 2 Replies
Jan 6, 2012
how i can do that, i have main flash file named container.swf (container.fla) i loaded external swf into movieclip inside my container. i want to know the actionscript version of the loaded swf dynamiclly, and the size(height and width) of it
View 4 Replies
Aug 15, 2009
Im working on an application for a website. When the user finishes entering all of the information into the Flass application, they press a button. I want it to open another page from that website and enter the information into it.
View 3 Replies
Mar 9, 2010
Here's the thing.I am making my first game, a click and drag (dress up if you want to ) game...It is finished and working..But since it serves as an educational aid in history group, it would be great if I could somehow add some kind of pop-up window with text describing every item in game..For example "14th century bascinet developed from the steel cap bla bla bla...".And if that is not possible is there some other way all this info about these items (there is about 24 items in game) could be fitted in this kind of application
View 4 Replies