Script Definition?
Could someone please explain what this script means?
ActionScript Code:
myMovieClip.onEnterFrame = function() {
this._x += (xMove1-this._x)/easeSpeed;
};
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 08-12-2004, 05:22 AM
View Complete Forum Thread with Replies
Sponsored Links:
Definition
hi!
can someone explain me what means this syntax in simply words?
Code:
rich = Math.round(Math.random()*2-1);
and how to know when it is true of false like
if(rich == true) {
do_something
} else {
do_nothing
}
suggestions?
thanx in advance!!!
View Replies !
View Related
Ref: Url Definition
In the following code segment, where is "clip" defined?...
function preload(clip) {
picture.loadMovie(clip);
Apparently syntax is:
loadMovie("url",target [, method]) does this mean that the "url" is clip?If so....where is clip spceified?
Thanks.
View Replies !
View Related
Gradient Definition Bar Is Gone Please Help
Okay, I've been having a headache over this, and I was wondering if anyone can help. I couldn't find any info on this.
Whenever I open the color mixer using "linear" in FLASH MX, the "gradient definition bar" used to appear. But for some odd reason it dissappeared all of a sudden and I can't get it back up. (See image below)
Is this a known issue or a bug? Is there anyway to fix it? Or do I have to reinstall FLASH MX everytime this happens?
Please help. I would greatly appreciate this. Thanks.
View Replies !
View Related
XML In A Class Definition
Hi all...
I'm loading XML directly into a class definition for the first time. My problem is that when I run the code below, the results I want traced come up as blank..nothing. It's loading the file, but obviously not parsing or reading it properly. Any help is very much appreciated. Thanks...
Code:
class rotator {
private var rotatorXML:XML;
private var XMLPath:String;
function rotator() {
}
public function init(XMLPath:String):Void {
rotatorXML = new XML();
rotatorXML.ignoreWhite = true;
rotatorXML.load(XMLPath);
rotatorXML.onLoad = function(success) {
if (success) {
trace(rotatorXML.firstChild);
} else {
trace("this ain't workin");
}
}
}
}
View Replies !
View Related
Component Definition
I am looking at code from a book example. A symbol is called from the library and used on the stage. The class appears to be dynamic because a reference to a variable called cardface appears out of nowhere in the as file (fla is set to STRICT). When debugging, the variable doesn't exist until the line where it is used. After this the variable can be seen. I am thinking to myself that the library right-click option "Component definition" would allow me to set the variable so that it is available in the Class. Unfortunately there is no guidance in the help system on this. I am required to endlessly search to try and get help (not yet found). Why does Adobe not give us this essential help - i.e. how to use their dialog boxes? I am such a fan of Flash (AS3) but there are some part of the system still painfully inadequate.
Any pointers would be appeciated.
View Replies !
View Related
High Definition
On vimeo.com, they compress uploaded high definiton video to high def flv...
youttube use ffmpegg to convert uploaded video to flv.
Do vimeo also use ffmpeg, but just change the ffmpeg compression to match the hd video being uploaded.
In other words does anyone know how to convert uploaded hd video into a hd flv?
kind regards J.
View Replies !
View Related
Component Definition
I am looking at code from a book example. A symbol is called from the library and used on the stage. The class appears to be dynamic because a reference to a variable called cardface appears out of nowhere in the as file (fla is set to STRICT). When debugging, the variable doesn't exist until the line where it is used. After this the variable can be seen. I am thinking to myself that the library right-click option "Component definition" would allow me to set the variable so that it is available in the Class. Unfortunately there is no guidance in the help system on this. I am required to endlessly search to try and get help (not yet found). Why does Adobe not give us this essential help - i.e. how to use their dialog boxes? I am such a fan of Flash (AS3) but there are some part of the system still painfully inadequate.
Any pointers would be appeciated.
View Replies !
View Related
Hit Area Definition
Hey guys!
New project - was having fun with it `til now!
http://www.geocities.com/steve_kitch/vega.htm
My problem, is the buttons' hit areas.
If you hover above the nav bar (left) it rollsover the button further down.
This is due to the fact I have a mc. on the "over" part of each button.
In this Mc. I have a large picture of fire moving behind a mask (text) to give the effect of the text burning. I have a feeling this is what is pushing the hit area out of place
Is there anyway of manually defining the hit area? Or anyway I can hide the Mc.'s parts from interferring? I tried creating a rectangle on the "hit" action in a button, but it doesn`t seem to work...any ideas?
Thanks very much for your time,
~STEVE
View Replies !
View Related
[AS 2.0] Var Definition Clarification
hey guys:
what, functionally, is the difference between:
Code:
var someVar:Number;
and
Code:
var someVar:Number = new Number();
i'll sometimes use them interchangably in a script without any seeming ill effect, so i just wondered what the difference was from a functional point of view. and yes, it's late and i'm waxing philosophical... must be the flat Coke Zero...
one thing i do know, is that the second version allows you to set some properties right off the bat, rather than use a second or third line to do it:
Code:
var someOtherVar:String = new String('bananas');
... but other than that... ?
danke mein volks!
WR!
View Replies !
View Related
What Is A Symbol Definition?
Okay,
I was using the "movie explorer" to find a particular symbol in my flash. I typed in the name of the symbol, since I couldn't find it in my library.
The movie explorer returned no results. So i clicked on "customize which items to show"... I put a checkmark in symbol definitions and the symbol i was looking for finally appeared.
I was able to find other symbols with that unchecked, but for this specific symbol... it doesn't appear in the movie explorer unless i put a check on "Symbol definitions".
I did a google search, but can't seem to find anything that talks about this. Kind of confusing.
Thank you in advance to all those who reply.
View Replies !
View Related
Class Definition
i want to make a class and then use it in a script
the scriptfile goes something like this:
class Image{
var m_name:String;
-- bla bla ---
}
and tghen i try to include this class in my flash file using this line:
#include "classes/Image.as"
and when i try to run the flash file i am getting this message:
**Error** ..classesImage.as: Line 1: Syntax error.
class Image{
Total ActionScript Errors: 1 Reported Errors: 1
what am i doing wrong ? please help
View Replies !
View Related
Class Definition (AS 2.0)
Hi guys,
I have experience with programming in Java so i thought id give AS2 a try to see how i like it.
I was gonna write a mortgage calculator for practice but I'm stuck at the first step.. lol
I have this in mortCalculator.as
ActionScript Code:
class mortCalculator {
var price:Number;
var percentdown:Number;
var propertytax:Number;
}
this in mortCalc.fla
ActionScript Code:
#include "mortCalculator.as"
and THIS is my error
**Error** C:WINDOWSDesktopmortCalculator.as: Line 1: Classes may only be defined in external ActionScript 2.0 class scripts.
class mortCalculator {
Total ActionScript Errors: 1 Reported Errors: 1
i would really appreciate it if someone can point me in the right direction .. its probably something simple that im missing.. thank u kindly in advance
View Replies !
View Related
ASBroadcaster : The Definition
In layman's terms (non dev speak) can someone describe to me what exactly ASBroadcaster is?
I've read a few posts here and visited chattyfig...but it's still a bit sketchy to me. I have an idea of what it is but not a concrete definition.
Can someone help?
View Replies !
View Related
GetBounds Definition
Hi,
i am working on a nested menu ...
my problem is when i copy the menu..i don't know how to redefine my boundaries for each menu in my code...
Code:
//--------
b01.onRollOver = panelOver;
b02.onRollOver = panelOver;
b03.onRollOver = panelOver;
b04.onRollOver = panelOver;
function panelOver() {
this.gotoAndPlay(2);
this.onEnterFrame = getBoundaries;
delete this.onRollOver;
}
var b = b01.stroke.getBounds(_root);
function getBoundaries() {
if (_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
this.gotoAndPlay(7);
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
}
//--------
enclosed the .fla which is probably more explicit..
if someone can help me...
View Replies !
View Related
+ Sign Definition
Code:
trace("this is execution "+i);
is this + sign for concatenation operation?
if yes, why there's concatenation operator assigned as add | String concatenation (formerly &) in the Operator List of Flash Context Help?
View Replies !
View Related
Component Definition - Nothing In Helpfiles?
Hi everybody,
In Flash 5 there was SmartClips, and in Library there was a window called "Define Clip Parameters". In this window were three columns: Name, Value, and Type.
Now in Flash MX we have a new thing, Components, which replaces old SmartClips. In Library is a similar window called "Component Definition" , but this time with four columns: Name, Variable, Value, and Type.
Anybody knows, what is this new "Variable" column for?
I tried to find a description of it in helpfile (offline), but it seems that there's nothing about it! I found only a help docs for the simple things, like how to use Components, but nothing about creating them or using this window.
Please give some info if you can or at least an URL to document describing this window.
Thanks in advance!
View Replies !
View Related
Functions Within A Class Definition?
I'm trying to make a basic drawing tool using classes. In one class (rectangle) I'm going to have a function, startDraw(), that invokes when the mouse is pressed and draws a square to the mouse _x and _y position, and then stop drawing when the mouse is released. The problem is I'm getting confused by class scope and functions. Here's my code, focused down to the problem:
Code:
class Rectangle {
var intervalID;
var mc;
function Rectangle(objectName, depth, currentX, currentY) {
mc = _root.createEmptyMovieClip(objectName, depth);
mc._x=currentX;
mc._y=currentY;
}
function startDraw() {
trace(mc._name);
intervalID=setInterval(drawBox,100);
function drawBox() {
trace(mc._name);
//plan on doing a - with(mc) { draw rectangle }
}
}
}
In my FLA, if I create a new Rectangle object (i.e. "box"), and do box.startDraw(), the first trace command works, but the second doesn't (the one within the drawBox() interval call. Can I not have a function, within a function, in a class?
If anyone has any suggestions, I'd greatly appreciate it. Thanks.
View Replies !
View Related
Error Message Definition
can anyone tell me what i can do to fix this error message? it comes up when i test my swf movie and i do not know why.
Scene=Scene 1, Layer=Layer 2, Frame=1: Line 1: Mouse events are permitted only for button instances
on (release) {
thanks for any help.
View Replies !
View Related
[F8] Why Does The Variable Lose Definition?
I done tried and tried to fix this thing, but for some reason, activating my navigation renders my reference variables (goalX and goalY) “undefined.” I would post these files, but they have confidential data. If necessary, I can replace the bmps with garbage. Hopefully, if I give the code and the debug output, someone can crack this puzzle.
There are four containers holding SWFs in this movie. One container (nav) holds the navigation, another (dataFile) holds an Excel spreadsheet bmp (this SWF delivers the values for the x and y arrays), another (head) holds the column headings, and a forth container holds tab buttons. The nav container includes navigation with four buttons, one for each direction. An _root array for x and another for y holds the various positions for head and dataFile (loaded from the dataFile container) .
Here is the _root code:
Code:
var i:Number = 0;
var u:Number = 0;
var goalY:Number = 150;
var goalX:Number = 0;
var myXArray:Array = new Array;
myXArray=[u];
var myYArray:Array = new Array;
myYArray=[i];
nav._alpha=35;
nav.onRollOver=function(){
nav._alpha=100;
};
nav.onRollOut=function(){
nav._alpha=25;
};
//Loading the first container++++++++++++++++++++++++++++++++++++++++++++++++++
this.createEmptyMovieClip("dataFile", this.getNextHighestDepth());
var mc1Listener:Object = new Object();
mc1Listener.onLoadInit = function(_loadedMC1:MovieClip) {
if (_loadedMC1 == _root.dataFile){
_loadedMC1._x = 0;
_loadedMC1._y = 150;
trace(dataFile._y);
}else{
trace("I'm afraid _loadedMC1 didn't load, or is not defined!" + _loadedMC1);
}
};
var MCdata:MovieClipLoader = new MovieClipLoader();
MCdata.addListener(mc1Listener);
MCdata.loadClip("Summary.swf",this.dataFile);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Loading the second container++++++++++++++++++++++++++++++++++++=
this.createEmptyMovieClip("head", this.getNextHighestDepth());
var mc2Listener:Object = new Object();
mc2Listener.onLoadInit = function(_loadedMC2:MovieClip) {
if (_loadedMC2 == _root.head){
_loadedMC2._x = 0;
_loadedMC2._y = 0;
}else{
trace("I'm afraid _loadedMC2 didn't load, or is not defined!" + _loadedMC2);
}
};
var mcHead:MovieClipLoader = new MovieClipLoader();
mcHead.addListener(mc2Listener);
mcHead.loadClip("SummaryHead.swf",this.head);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Loading the third container++++++++++++++++++++++++++++++++++++=
this.createEmptyMovieClip("tabs", this.getNextHighestDepth());
var mc3Listener:Object = new Object();
mc3Listener.onLoadInit = function(_loadedMC3:MovieClip) {
if (_loadedMC3 == _root.tabs){
_loadedMC3._x = 0;
_loadedMC3._y = 514;
}else{
trace("I'm afraid _loadedMC3 didn't load, or is not defined!" + _loadedMC3);
}
};
var mcTabs:MovieClipLoader = new MovieClipLoader();
mcTabs.addListener(mc3Listener);
mcTabs.loadClip("TabControl.swf",this.tabs);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Loading the forth container++++++++++++++++++++++++++++++++++++=
this.createEmptyMovieClip("nav", this.getNextHighestDepth());
var mc4Listener:Object = new Object();
mc4Listener.onLoadInit = function(_loadedMC4:MovieClip) {
if (_loadedMC4 == _root.nav){
_loadedMC4._x = 300;
_loadedMC4._y = 20;
//_loadedMC4.swapDepths(_root.getNextHighestDepth());
}else{
trace("I'm afraid _loadedMC4 didn't load, or is not defined!" + _loadedMC4);
}
};
var mcNav:MovieClipLoader = new MovieClipLoader();
mcNav.addListener(mc4Listener);
mcNav.loadClip("NavController.swf",this.nav);
Here is the code loaded from the dataFile SWF:
Code:
Stage.align="TL";
_root.myXArray=(0, -34, -81, -128, -176, -162, -223, -273, -323);
_root.myYArray=(150, -264);
Here is the code loaded from the nav container’s SWF:
Code:
//This file loads to one of four containers on the main timeline. This file allows the user
//to move the dataFile container holding the spreadsheet data rows. The onEnterFrame function
// references a root an array on a file loaded to the dataFile container. Each time the user
//click an arrow, the variable for array position changes the goalY or goalX variable on the main timeline.
//These two variables control the scroll functionality for both the dataFile and the head containers.
function slideY() {
_root.dataFile.onEnterFrame = function() {
_root.dataFile.diff = Math.abs(_root.dataFile._y-_root.goalY);
if (_root.dataFile.diff<1) {
_root.dataFile._y = _root.goalY;
_root.head._y = _root.goalY;
delete _root.dataFile.onEnterFrame;
} else {
_root.dataFile._y += (_root.goalY-_root.dataFile._y)*.3;
_root.head._y += (_root.goalY-_root.head._y)*.3;
}
}
};
function slideX() {
_root.dataFile.onEnterFrame = function() {
_root.dataFile.diff = Math.abs(_root.dataFile._x-_root.goalX);
if (_root.dataFile.diff<1) {
_root.dataFile._x = _root.goalX;
_root.head._x = _root.goalX;
delete _root.dataFile.onEnterFrame;
} else {
_root.dataFile._x += (_root.goalX-_root.dataFile._x)*.3;
_root.head._x += (_root.goalX-_root.head._x)*.3;
}
}
};
//These functions set the goal variables and activates scrolling (above)
downM.onRelease = function() {
_root.myYArray[i++];
_root.goalY = myYArray;
slideY();
};
upM.onRelease = function(){
_root.myYArray[i--];
_root.goalY = myYArray;
slideY();
};
rightM.onRelease = function() {
_root.goalX = _root.myXArray[u++];
slideX();
};
leftM.onRelease = function(){
_root.goalX = _root.myXArray[u--];
slideX();
};
//These functions animate the arrows to give the user notice of function
//I initially nested this code with the arrows symbol, but there was some
//conflict preventing that from working. Instead of figuring it out, just moved
//them to this timeline. The negative: 8 functions instead of 2. The positive: this works.
leftM.onRollOver=function(){
leftM.play();
}
leftM.onRollOut=function(){
leftM.gotoAndStop("home");
}
rightM.onRollOver=function(){
rightM.play();
}
rightM.onRollOut=function(){
rightM.gotoAndStop("home");
}
upM.onRollOver=function(){
upM.play();
}
upM.onRollOut=function(){
upM.gotoAndStop("home");
}
downM.onRollOver=function(){
downM.play();
}
downM.onRollOut=function(){
downM.gotoAndStop("home");
}
Head carried no script.
I have attached the debug output after I’ve clicked on the buttons. Obviously, the containers do not move as intended. But why?
View Replies !
View Related
Externally Visible Definition
i keep getting the error following error:
5007: An ActionScript file must have at least one externally visible definition.
the scenario is a simple fla file that includes an external actionscript file. If i copy the code from the external actionscript file into the frame where the include code is, there is no change, i still get the error. the external actionscript file doesn't have any packages or classes, just a few functions and other stuff like that
View Replies !
View Related
Definition The:Greeter Could Not Be Found
when i import with "import Greeter;" then the code below works. the file was saved as Greeter.as
Code:
package
{
public class Greeter
{
public function sayHello():String
{
var greeting:String;
greeting = "Hello World!";
return greeting;
}
}
}
However, in the code above, when i added the word "the" in front of the word package then i get the error Definition the:Greeter could not be found. the file was saved as the.Greeter.as
i imported it as "import the.Greeter;"
Why am i getting this error?
View Replies !
View Related
Method Definition Outside Of Classes
This is more of a stylistic thing...Is there a way to declare all the methods within a class, and then define those methods outside of the class?
So instead of
Code:
class person{
function Talk()
{
///...insert many lines of code
}
function Walk()
{
//...insert many lines of code
}
function Examine()
{
//...insert many lines of code
}
}
Is there something like this? (Obviously the syntax below isn't correct assuming there even is one).
Code:
class person{
function Talk();//declare functions here
function Walk();
function Examine();
}
//define methods here
person.Talk()
{
//insert many lines of code
}
person.Walk()
{
//many lines of code
}
person.Examine()
{
//many lines of code
}
Or is the best thing I can do is Interfaces?
View Replies !
View Related
Something Strange With Variable Definition...
Hello actionscript people
I have a problem with something I really don't understand with actionsrcipt
Have a look at the following code:
Code:
{var t:Number=10
_level0.func3=function(){return(t)}
}
//here the variable t is defined locally in the braces
trace(_level0.func3())
// this gives 10.
//The function func3() seems to have remembered the value of t
{var t:Number=11
_level0.func4=function(){return(t)}
}
trace(_level0.func4())
// this gives 11.
// Once again the function seems to have remembered the value of t
trace(_level0.func3())
// Now I don't understand. This do not give 10 anymore but 11!!!
//the variable t=11 has been defined ONLY locally in braces
//that do not contain the function func3!
var t:Number=14
trace(_level0.func3())
// now this gives 14. I am not sure to understand this result,
// given that the function seemed not to remember the variable
//but the value inside the variable...
Somebody can explain me this strange result?
View Replies !
View Related
Is Package A Must With A Class Definition ?
hi all,
i'm still learning new concepts of AS3, here comes my first question:
is it a must to use package keyword with class definition like this ?
ActionScript Code:
package
{
class TestClass
{
//
}
}
can we define a class without package keyword anyway as below ?
ActionScript Code:
class TestClass
{
//
}
thanks.
View Replies !
View Related
For Loop Button Definition
hi there,
this is a for loop problem which i cant solve. can anyone show me "the way of the master"?
in this example i want to use a for loop to quickly define my 3 buttons. what i want is simple. i want a way to id each button upon click.
so i have 3 buttons with the instance name "thumb1", "thumb2", "thumb3"
then i put the following code on frame 1.
for (i=1; i<3; i++) {
this["thumb"+i].onRelease = function() {
trace(i);
};
}
i get the trace result "3" no matter which button i click. i realise the for loop goes thru once and the last digit thru the loop will be displayed.
i don't want this. i want to click on thumb1 and get "1". click on thumb2 to get result "2" etc.
the only way i know is to use this way with trace (this).
for (i=1; i<3; i++) {
this["thumb"+i].onRelease = function() {
trace(this);
};
}
but i get "_level0.thumb1" when i click on thumb1. then i will have to substring this string back to "1". this is a hassle and not to mention probably a lame way to do this. how can i simplify what i want without going thru the unnecessary steps? anyone? thanks
raskol
View Replies !
View Related
Class Definition Problem
Hi all...
I want to call a function from within a mouse event in a class definition. It doesn't work. Somebody please help! (i'm got a deadline coming fast). Here's an abstract example of what I mean...
Code:
class someClass() {
public function someClass(from:MovieClip, to:MovieClip){
from.onRelease = function() {
drawLine(from, to);
}
}
private function drawLine(from:MovieClip, to:MovieClip) {
//function does something here//
}
}
I can't get the function named drawLine to run from the onRelease event. If anyone knows what I'm doing wrong, please let me know as soon as possible. Thank you for your time.
View Replies !
View Related
Site Definition Via Flash?
Hello Flash People of the Universe,
I'm a multimedia design looking for a technique to create an index SWF page in Flash.
I have heard it through the grapevine that a 100% Flash-based homepage will load much, much faster than a HTML index page
calling for the SWF file.
Is this a myth or true? If it is true, how can I create an index SWF page in flash. Should I use cold Fusion ect..
Please help with this concept.
View Replies !
View Related
Camera.activitylevel Definition
http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary120.html
In the above link the activitylevel property of the camera object is described. This is said to be a number between 0 and 100, where 100 means that a large amount of motion is being detected. Could anyone tell me what is meanth by 'a large amount'? Does this mean that all pixels are different than in the previous frame? What exactly does this number mean?
I need this information because I am currently doing a research at the Technical University Delft, using Flash and a webcam.
Thanks in advance for a reply.
Joost van der Schee.
View Replies !
View Related
Site Definition In Flash
Tech People,
I have designed a home page that uses alot of flash animation (about 90%).
The main SWF animation file is 2 megabytes, and the other single SWF files are under 1 meg.
I would like to combine the SWF files into one basic Flash index page. All of the animation SWF files
reside in a PHP document. I have heard though the grapevine that: "a 100% Flash homepage is faster".
Is the a way to create a index page strictly in Flash? If so how d you do it? - Just create a swf homepage called index.swf (which doesn't seem possible! How can I increase the speed of my animated SWF files while decreasing the size of the files?
Sincerely,
"ColdAir"
View Replies !
View Related
OnLoadInit In Class Definition
Hey all, how's it going. I have a quick question/minor problem with my code, and was wondering if any of you could enlighten me on the situation.
In a nutshell, here is the deal... I have a class that deals with image galleries and such, and in the constructor of my class
Code:
function ImageGallery()
{
_imgFullLoader = new MovieClipLoader();
_imgFullListener = new Object();
_imgFullListener.onLoadInit = function(targetMC:MovieClip):Void
{
targetMC._x = targetMC._width * (_imgCount + 10);
}
}
The _imgCount variable is a number that I've declared, initialized to 0, and it is incremented each time a new image is loaded. The problem is, that within the onLoadInit code block, it is being treated as undefined. The
images load fine, but their x values remain constant, since _imgCount is treated as undefined. How do I make it to where onLoadInit can retrieve the true value of _imgCount within the class definition?
Thanks in advance. Talk to you later.
View Replies !
View Related
AS3 - Duplicate Variable Definition?
If I have the following AS3 code inside of a class:
PHP Code:
public function doStuff():void{ for (var i:uint = 0; i < myArray.length; i++) { // do stuff } for (var i:uint = 0; i < myArray.length; i++) { // do stuff }}
I get a "Duplicate variable definition" compiler complaint. Obviously I could declare the i variable once within the function call to avoid the issue, but I shouldn't have to. The first i should be out of scope before the second for loop begins. Any ideas?
Thanks,
~JC
View Replies !
View Related
Duplicate Variable Definition ?
I need to drag out some variable from my HTML , eg:
loaderInfo.parameters.limitext;
But I want to reserve a default value for that in case the HTML is broken , so I write:
if (loaderInfo.parameters.limitext == null)
{
var extension_str:String = "*.jpg;*.gif;*.png";
}
else
{
var extension_str:String = loaderInfo.parameters.limitext;
}
Thus way I get a warning. So .. any good idea to avoid this ?
View Replies !
View Related
Drawing In Class Definition
Hi everybody,
I am sorry if this is a stupid question but I have searched for the last 3 days and I did not find an answer to this.
I want to create a class which extends a MovieClip class and I am trying to have in te constructor of the class to draw some graphic. Is this even possible of is there something I do wrong? I get no error but I can't see anything on the screen.
Code in Flash:
-------------
var tabel = new data_matrix();
-----------------------------
Code in text editor - where I buid the class:
------------------------------------------
class data_matrix extends MovieClip{
public var dshape:MovieClip;
function data_matrix(){
dshape=this.createEmptyMovieClip("dshape1",100);
dshape.lineStyle(0, 0xFF0000, 100);
dshape.lineTo(100, 0);
dshape.lineStyle(0, 0x00FF00, 100);
dshape.lineTo(100, 100);
trace(this._name);
}
-------------------------------------------
Also the trace command above displays UNDEFINED like the object is not even defined.
I thank you very much in advance.
View Replies !
View Related
MC - Component Definition Problem
Hi,
I want to make controls that will be filed up with options trough Parameter window inside flash.
To do so, I’ve created MC, put combo box inside it.
In Library I’ve clicked on MC and chose Component definition from context menu and setup parameters.
I’m having problems putting options inside my combo box. It will be much easier to understand when you look at FLA file. http://www.fulek.com/GAL/kirupa.zip
Thanks in advance
View Replies !
View Related
OnLoadInit In Class Definition
Hey all, how's it going. I have a quick question/minor problem with my code, and was wondering if any of you could enlighten me on the situation.
In a nutshell, here is the deal... I have a class that deals with image galleries and such, and in the constructor of my class
Code:
function ImageGallery()
{
_imgFullLoader = new MovieClipLoader();
_imgFullListener = new Object();
_imgFullListener.onLoadInit = function(targetMC:MovieClip):Void
{
targetMC._x = targetMC._width * (_imgCount + 10);
}
}
The _imgCount variable is a number that I've declared, initialized to 0, and it is incremented each time a new image is loaded. The problem is, that within the onLoadInit code block, it is being treated as undefined. The
images load fine, but their x values remain constant, since _imgCount is treated as undefined. How do I make it to where onLoadInit can retrieve the true value of _imgCount within the class definition?
Thanks in advance. Talk to you later.
View Replies !
View Related
Class Parameter Definition?
hi there,
I'm still a rookie but I'm trying to code something like the QuickButton class LeeBrimlow uses in one of his tuts! now the only question I have is, how can I set a parameter kind of typed like in the tweener class where you type a parameter for instance "transition" or "time"...because if you look on my code:
Code:
package
{
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class QuickButton extends Sprite
{
public function QuickButton(btntext:String, txtcolor:Number = 0xFFFFFF, outcolor:Number = 0x000000, overcolor:Number = 0x666666, direct:Object= null):void
{
var tf:TextField = new TextField();
var format:TextFormat = new TextFormat();
format.font = "Arial";
format.color = txtcolor;
format.size = 12;
format.align = "center";
tf.defaultTextFormat = format;
tf.selectable = false;
tf.text = btntext;
tf.width = 100;
tf.height = 20;
tf.background = true
tf.backgroundColor = outcolor;
addChild(tf);
tf.addEventListener(MouseEvent.MOUSE_OVER, over)
tf.addEventListener(MouseEvent.MOUSE_OUT, out)
tf.addEventListener(MouseEvent.CLICK, go)
function over(e:MouseEvent) :void
{
tf.backgroundColor = overcolor;
}
function out(e:MouseEvent) :void
{
tf.backgroundColor = outcolor;
}
function go(e:MouseEvent)
{
if (direct == null)
trace("Function parameter not set!")
else
direct()
}
}
}
}
so now I have the first parameter for the text in my button, the second parameter is the txtcolor and so on, however the last param is the function the button should execute.. and now if I create a new quickbutton and I don't wanna set the txtcolor, or the overcolor? imageine I just wanna leave the colors by default and set as second param the function...how can I do that..can I simply type this param like in tweener?
for instance the function param can be called by using func:functionname!
is that possible
thanks and regards matt
View Replies !
View Related
Using Variables From LoadVars In Function Definition
I have an array of movie clips which move when rolled over. I use a global function to do the moving, and assign it to each clip's onRollOver method. All the clips move at the same velocity, which is determined by timeline variables m and n. All this works fine.
Now, I want to read the velocity (m, n) from a text file, using LoadVars. Now it goes haywire: the values of m and n are correctly assigned to clip.xvelocity and clip.yvelocity, but the actual movement does not correspond.
I have tried several ways of ensuring that the functions which do the movement are not defined until after LoadVars.load() is complete, including making them non-global and (as below) putting them on frame 2. All to no effect.
I'm stumped. Can anyone suggest what might be going on here?
Simplified code which exhibits the problem:
Code:
---------------Code on Frame 1--------------------
stop();
// Using these parameters, motion works
var m = 5;
var n = 2;
lv = new LoadVars();
lv.onLoad = function(success) {
for(var p in lv) {
_root[p] = lv[p];
}
_root.gotoAndStop(2);
}
// If we load the same values from a file, motion doesn't work
lv.load("config.txt");
---------------Code on Frame 2--------------------
_global.move = function() { // function to start moving
if (this.isMoving) return;
this.isMoving = true;
this.xvel = m;
this.yvel = n;
trace("My velocity is (" + this.xvel + ", " + this.yvel + ")");
this.xorig = this._x;
this.myInt = setInterval(this, "moveStep", 20);
}
_global.moveStep = function() { // one step of the motion
this._x += this.xvel;
this._y += this.yvel;
if ( Math.abs(this._x - this.xorig) > 50 ) { // far enough
clearInterval(this.myInt);
this.isMoving = false;
}
}
// Create a clip that can move
clipCount = 0;
makeClip = function() {
createEmptyMovieClip("mc", clipCount++);
mc.lineStyle(10, 0, 100);
mc.moveTo(0,0);
mc.lineTo(20,0);
mc._x = mc._y = 50;
mc.move = _global.move;
mc.moveStep = _global.moveStep;
mc.onRollOver = mc.move;
}
makeClip();
---------------Contents of config.txt--------------
&m=5&
&n=2&
View Replies !
View Related
How To Access A TextArea From A Class Definition?
Code:
import mx.controls.TextArea;
class printClass extends MovieClip {
// define vars
var printArea_mc:MovieClip;
var print_txta:TextArea;
var test_txt:TextField;
var myText:String;
var print_btn:mx.controls.Button;
var myPrintJob:PrintJob;
//
function printClass() {
//this returns correctly
trace(printArea_mc.print_txta._name);
//none of this works
this.printArea_mc.print_txta.label.text = "myText";
printArea_mc.print_txta.label.text = "myText";
this.printArea_mc.print_txta.text = "myText";
printArea_mc.print_txta.text = "myText";
trace(this.printArea_mc.print_txta._vPosition);
//populating a normat text field works
this.test_txt.text = "myText";
}
}
I have tried a dozen different approaches to this with no luck. The problem is that I CANNOT access any of the TextArea specific properties for with in this class definition. Everything was working fine before I ripped the code off the main time line and put in in a class. I cannot set/get the text or any other property.
I think that the problem is that I am not correctly "strict typing" the TextArea var. I suspect that the class thinks that it is a MovieClip. I have tried several options for the type: MovieClip, TextField, mx.controls.TextArea, MovieClip.mx.controls.TextArea, MovieClip.TextField, etc.
Do I need to set the nest or something?
like:
var printArea_mc.print_txta:TextArea; OR
var printArea_mc[print_txta]:TextArea; OR
var printArea_mc:MovieClip.print_txta:TextArea;
or something
pls help.
Any ideas?
thanks for help
--mm
View Replies !
View Related
Label Style Definition From Class
I'm trying to follow the documentation for setting text attributes on components via the Style Object and it sure seems like this code should work. (it's not) The code's sitting in a class method...everything works except the application of the style definitions themselves so it's either a typo somewhere or some additional set required cuz it's in a class.
Code:
var styleObj = _global.styles.labelStyle = new mx.styles.CSSStyleDeclaration();
styleObj.textAlign = "right";
styleObj.fontWeight = "bold";
// Lable for firstName
var inputFName_lbl:Label = login_mc.createClassObject(Label, "inputFName_lbl", 21);
inputFName_lbl.autoSize = "left";
inputFName_lbl.text = "First Name:";
inputFName_lbl.move(-100, title.y + title.height + 30);
inputFName_lbl.setStyle("styleName", "labelStyle");
View Replies !
View Related
AS2: Font Name - Component Definition Thru Inspectable
Hi everone,
I'm making a class where I want a font picker just like the color picker.
I'm creating the component definition thru AS [Inspectable]
Here's a sample entry:
Code:
[Inspectable(defaultValue=FFFFFF, type=Color)]
public function set bgLineColor(c:Color):Void
{
_nBGLineColor = parseInt(c.toString() );
}
public function get bgLineColor():Color
{
var c:Color = new Color;
c.setRGB(_nBGLineColor)
return c;
}
That entry creates a color picker without me having to manually go to the Component Definition.
I know that you can create a Font picker because seeing through the items you can add in the Component Definition, you see "Font Name" as a type. However, I tried that:
Code:
[Inspectable(defaultValue="Arial", type=Font Name)]
public function set sFont(s:String):Void
{
_sFont = s;
}
public function get sFont():String
{
return _sFont;
}
but it doesn't work.
Need your help.
Thanks!
View Replies !
View Related
Global VScrollPolicy Definition Rejected
Hi Board,
I´m running into a mystery I can´t solve, if anyone could point me into the
right direction i´d be very thankful.
I´m defining some global StyleSheet properties for MM V2 Components in Flash
8 Pro like this
Code:
_global.styles.Tree = new mx.styles.CSSStyleDeclaration();
_global.styles.Tree.setStyle("backgroundColor", 0xEEEEEE);
_global.styles.Tree.setStyle("rollOverColor", 0xFFFFFF);
//...and so on until
_global.styles.Tree.setStyle("vScrollPolicy", "auto");
now every Style is accepted except the vScrollPolicy, it behaves as it would
be "on" which is the default value.
It´s the same for List and DataGrid Components.
If I directly assign the style to an instance like this
_root.command_tr.setStyle("vScrollPolicy", "auto");
everything works,...
Any clues for me?
Thanks,
André
View Replies !
View Related
|