ActionScript 2.0 :: Class Based Function Hiccup?
Feb 27, 2007
This one is going to take some setup, so bear with me,I have built an actionscript file to be used as a class library (i think that is what i would call it), it looks like this:
[Code]...
That is to say, when i press a key on the keyboard once, the loaded movie follows the mouse. But when i press the same key again, the first loaded movie stops, and the new one loaded follows the mouse. What happens. I should note that when i use and #include to call the same chunk of code, the problem vanishes.
View 5 Replies
Similar Posts:
Feb 17, 2011
I've got a simple program that consist of a document class and a buttonTemplate constructor class. I need to call a function called updateText that should be in the document class, when someone clicks on a button. So that after each button is clicked, it updates some text in my document class. My event listeners for the buttons are in the buttonTemplate class. My question is, how do you call a function in the document class from a constructor class? Here is my simplified code below
DOCUMENT CLASS
Code:
package {
import flash.display.MovieClip;
import flash.text.TextField;
[Code].....
View 6 Replies
Jun 30, 2010
I finished my flash logo for work and am now having a problem when trying to publish/export/play the file. On frame 110 when the first shimmer crosses the "M" I get a hiccup on that frame, it should be a smooth transition. Once the video plays once the replay works fine, but this is going to be the intro to our website, one time view.
The playback was working great the day before. Today, after some more tweeks, not so good. Only thing I could fathom was maybe too many masks (added 1 more today, 3 in total) were being applied but I tried removing all masks and am still having the same problem.
Visit the link to view intro:Metagraphics Intro
View 2 Replies
Mar 10, 2009
So, the good news is that I've got this about 90% solved. Anyway, I'm trying to use TweenMax to have a drop shadow fade up on a Mouse Event (on a roll out). Everything works fine except for the shadow color. I've got it set to black (0x000000), but it's making a shadow that's the same color as the menubar sprite it's trying to shadow.
In other words: I've got a bright blue menu button, and it's giving it a bright blue shadow, despite the fact that I've got the color value set to 000000. Basically, I've got some code to put together the parts of the menubar (size, shape, text, shadow, etc.)
[Code]...
View 2 Replies
Feb 17, 2011
Is there a way to generate an instance of a class that implements an interface based on the name of the class?
I am trying:
var ClassReference:Object = getDefinitionByName("movement.OuterSpaceMovement") as IMovement;
var m:IMovement = new ClassReference as IMovement;
trace("startup..." + m);
-But I am getting an error message ReferenceError: Error #1065 (OuterSpaceMovement) not defined.
I have several classes that implement the same interface (IMovement) but I need to be able to generate new instances of these classes and then pass these instances as a datatype (IMovement datatype) to other classes...
So then I tried:
var ClassReference:Class = getDefinitionByName("OuterSpaceMovement") as Class;
var m:IMovement = new ClassReference() as IMovement;
and this doesn't seem to work...but the following
var m:IMovement = new OuterSpaceMovement();
View 1 Replies
Dec 15, 2009
how do use a function from a doc class.... to call a function to work on in
[Code]...
View 2 Replies
Dec 26, 2011
i have a repeater :
PHP Code:
<mx:Repeater id="btnRepeater" dataProvider="{rep.currentItem.BUTTON}">
<mx:Button label="{btnRepeater.currentItem}" click="getDefinitionByName('{btnRepeater.currentItem.@EVENT}')"/>
</mx:Repeater>
and i want to call some how to a function with a value i get from the xml: getDefinitionByName('{btnRepeater.currentItem.@Fun ctionName}')
View 4 Replies
Dec 29, 2010
im currently writing a piece of code where i need to get all children that are specific class or extend one.
currently im using this
ActionScript Code:
public function getConnections():Vector.<NodeConnection>{
var res:Vector.<NodeConnection> = new Vector.<NodeConnection>();
[Code].....
The problem with this is that 1st, string comparison is slow, and im expecting that there will be hundreds, of instances on stage. and secondly, It is very probable that i will extend the classes that i use in the functions, so their toString() will produce different name. e.g if i have on stage instances of "Node, ExtendedNode1, ExtendedNode2 " since they are all nodes, id like to all of them be returned.
View 4 Replies
Nov 2, 2010
I have some ActionScript code that splits a string using Regular Expression and lets me add content at the split location.
// AS3 Code
function formatTweetText(tweet:String ):String
{
[code]....
View 4 Replies
Aug 18, 2009
If the province is zoomed IN when I click another province I want it to return to its original size and have the next province that I clicked on zoom IN. Each time I zoom a province IN I want to set a variable to the value 1 so that I can use it as an indicator to let me know the status of the other provinces. Ie: if variable ON (Ontario) has a value of 1, then when I zoom IN on Manitoba I will use an IF statement to determine that Ontario is currently zoomed in (ON has a value of 1) and will zoom Ontario out prior to zooming in Manitoba. When I zoom out Ontarion I will reset the ON variable to 0. My code for Ontario looks like this[code]...
View 1 Replies
Nov 4, 2009
ActionScript [code]...
how to make it run a function based on var's value?[code]...
View 1 Replies
Dec 12, 2009
I have some movie clips that I want to load by using a text box. The way I want to do it is to have a text box and based on the word typed into it call the respective movieclip. My problem is that I do not know how to call the function based on the event of someone hitting the "enter" key.
View 3 Replies
Feb 16, 2005
say I want to declare a global variable in my main movie on a mouse event (button) and give it a value "functionA".
then I want to load an external .swf into a clip (with the same mouse event)
then I want some code in the loaded .swf to execute a function of the same name "functionA"
how would I code this?
this way I could load the same .swf but execute different functions depending on which button triggered the load... comprende?
View 5 Replies
Jan 26, 2010
How can I get a variable to change based off of a function? For instance.
var imageNumber = 1;
And when I click on the next button it kicks off roughly this function.
imageNumber ++;
Effectively adding to the image number. But it is confined only to that function. The imageNumber outside of that function didnt change. How can I get the next button to change the number outside of the function?
View 5 Replies
Apr 21, 2011
We are building an application which is using skin classes in mxml. We plan to build different variants of this application for different user segments, where most of the functionality remains same but only skins vary based on the user segment.We are adding skins to the application by the following syntax:
<s:BorderContainer id="Banner" height="15%" width="100%" skinClass="mySkins.backgroundSkin"/>
Is there a way we can have a skin based on some conditioni.e if usersegment = "A" then use myskins.backgroundSkin1, else use myskins.backgroundSkin2?
View 2 Replies
Sep 29, 2009
I'm brand new to actionscript and I've decided to try and make an overhead tile scrolling game. It's been going good so far, but here is my problem:
I have the level data stored in an array, where the number represents the corresponding tile.
I have movie clips in my library called "tile_1", "tile_2", "tile_3" etc.
Anyway, what I was thinking of doing was this:
var newTileContents:("tile_"+lvlArray[i]) = new ("tile_"+lvlArray[i])();
newTile.addChild(newTileContents);
Where, if the value in the lvlArray at [i] is 2, then it will create an instance of tile_2 etc.
But I am not sure how to to type the "tile_"+lvlArray[i] bit properly.
View 7 Replies
Apr 17, 2011
Any smart people out there who can tell me why this function Im working on to automatically sort the depths of objects placed on the 3D plane is only working intermittently? It seems to work every second or third iteration?[code]Is getChildAt(i) reliable? IE does it return the same order each time it runs or is it based on depth? looking at the manual suggests that it's probably the latter so I guess I'll need to make my own array ordered by the time the sprites were added to the parent and work from there. Is there a better way?
View 1 Replies
Nov 23, 2004
I have some code that makes a variable based on an MC's name:
[Code]...
but it doesn't work, yet it traces "_level0.but1menu", and trying the function as this: _level0.but1menu.easeY(100) does work. I've also attached a mock up if you want to see what I mean. al input, this one seems weird to me - but I'm sure there is a completely logical explanation. I've used the same sort of idea to open external swfs with no issue.
View 1 Replies
Feb 12, 2009
I'm new to FLEX.I've a requirement where i do have to load the data into Class Based Model(VO) from an Employee.xml which has got employeeName,departmentName,address & projectId tags.
View 0 Replies
Oct 17, 2003
I am trying to build a component based on a class where when you enter a label at design time (in the properties panel), it displays on the component on the stage. This is done in all the FUI Components that have labels and I was wondering if any one knows which part of the code does this.
View 6 Replies
Dec 2, 2010
I have built a class based on a calendar script found here on this forum. I have modified the script to work in a class and expanded on the calendar by checking each day of the month against a database to see if there are events on that day. (if there is an event, the day movie clip goes to another frame to highlight said day)Everything works great.. at first glance. The first time the calendar loads, all the days are properly in place and the Event.ADDED_TO_STAGES runs correctly, highlighting the dates with events.
The problem occurs when the user changes the month. Everything again works the way it should except for the Event.ADDED_TO_STAGE. This event only runs for each day the first time the calendar is loaded.
Code:
package classes {
//import necessary classes
import flash.events.*;
import flash.display.MovieClip;
[code].....
View 2 Replies
Dec 29, 2011
I'm trying to create a function that draws a polygon with two parameters that are: number of sides and length of sides. You would input a number for side length and a number for the number of sides. Then it would draw the side length, then turn at a angle based on the number of sides, then draw side length again... until it has finished drawing the polygon based on the number of sides that were put in.
View 1 Replies
Dec 14, 2006
Im trying to write a function that will build a menu based upon the vars that I passed it to. This is a simpler version on the code.(The library has a MC/Btn symbol with the linkage "btn");
Code:
function bulidMenu(nItems:Number) {
var menuMCx:Number = 100;
var menuMCy:Number = 100;
[code]...
Why do I get an output of 4 on every clicked button, instead of 0,1,2,3 ? I tryed forwarding the " i " to the onRelease = function(i) {} and then in it declaring a new var and assigning it the passed " i ", but that doesn't work either :/
View 4 Replies
Mar 4, 2008
So your playing a flash game that's fast paced and mouse-based (hey that rhymes somewhat)... And then you accidentally move your mouse outside of the area of the swf... And then it pauses automatically with a "Continue" button, instead of you just dying or whatever. I've thought you could have a huge button the size of the stage and make it do something when the frame isn't 'mouseover' or whatever, but there's gotta be a better way. Also setting limits on the _xmouse and _ymouse wouldn't work cos sometimes the mouse moves too fast for them to accurately get the last mouseposition...
View 8 Replies
May 22, 2009
Let's say I have a Custom Event Class, and it has several Event types stored in static Constant:
[Code]...
Is there an easy way to validate that the type passed to the Constructor is one of the Static Constants of the Class, without having to check it against each value?
View 5 Replies
Jan 29, 2012
If I have three classes:
public class Example {
public function Example () {
}[code]............
You can see that the two last classes extend the first one, and both have the 'variable' property. In case that I have an instance of Example and I am sure it is also an ExtendedExample OR AnotherExtendedExample instance, is there some way to access the 'variable' property? Something like
function functionThatReceivesAnExtendedExample (ex:Example):void {
if(some condition that I may need) {
ex.func()
View 3 Replies
May 29, 2011
I have an array, which are the literal names of class references. Eg. in my main class I have
var page1:PageOne = new PageOne();
var page2:PageTwo = new PageTwo();
var page3:PageThree = new PageThree();
[code].....
View 1 Replies
Dec 14, 2011
I have a project which consists of 4 frames (+ one starting frame), where each frame contains a Timer class based-animation. You can visit each frame by selecting the appropriate button.
Let's say the animation in frame1 lasts for a total of 30 seconds, but I'm too impatient to watch it and decide to go frame2, which also I don't like. In the background however, the animation for frame1 is still running, for when I go to frame 2 and go back to frame1, the animation starts both from the beginning and also continues to play from where I left off.
I also get an error:
TypeError: Error #1009: Kan geen eigenschap of methode benaderen via een verwijzing naar een object dat null is.
at fl.transitions::TransitionManager/saveContentAppearance()
at fl.transitions::TransitionManager/set content()
at fl.transitions::TransitionManager()
[Code]...
View 1 Replies
Nov 1, 2010
I have a string variable, and based on the value of that variable, I want to create an instance of a class, I can do that with this code:
Code:
var boxType:String = "BigBox";
switch(boxType)
{
[code]....
View 3 Replies
Aug 23, 2009
I have a SendData class that sends form info to a php script. It is a static class that does not extend anything. I want to be able to dispatch an event if there is an error, or when it gets info back from the server. I have a custom event class that I have been using to dispatch events like this, but I have only used that in displayObject extended classes.The problem is, it seems like something has to be a displayObject based class to dispatch events. I know there must be a way to do this, but I'm having trouble finding it in searches.
View 2 Replies