AS3 Math issue
If i have this code:
var test: Boolean;
test = false;
if (2 == 2 == 1)
test = true;
trace (test);
Result: true.
var test: Boolean;
test = false;
if (2 == 2 == 2)
test = true;
trace (test);
Result: false
var test: Boolean;
test = false;
if (2 == 2 == 3)
test = true;
trace (test);
Result: false.
Why is that?
This is not a Math issue, it is a matter of how a condfitonal test is carried out. Conditions are tested as pairs (with a left to right hierarchy unless otherwise arranged using parentheses), meaning for 2 == 2 == whatever, first the test is performed to see if 2 == 2 ?, which is true, meaning the result evaluates as a "true". Then the next comparison is performed using the result of the first... which would be... true == whatever ?. which depends on "whatever" is. A 1 evaluates as true as far as logic goes, but any other number does not, so true == 1 = true, true == 0,2,3,4,5.... = false
You will find nothing passes the test if you reverse the order of the numbers.
If you want to do compound conditional tests you are best to do it in pairs and/or use parentheses to define the order in which evaluations are managed.
Similar Messages
-
Flash CS5 AS3 Preloader Issues
Hi.
I'm a complete novice with Flash and at risk at looking like 'Dumbest Poster of the Year', I'm requesting help/advic over a couple of issues.
My first concern is with a very simple preloader I've made for a movie. Here is the code (posted in first frame of movie; nothing else is in the frame except for the preloader itself):
import flash.events.Event;
stop();
addEventListener(Event.ENTER_FRAME, loaderF);
function loaderF(e:Event):void{
var toLoad:Number = loaderInfo.bytesTotal;
var loaded:Number = loaderInfo.bytesLoaded;
var total:Number = loaded/toLoad;
if(loaded == toLoad) {
removeEventListener(Event.ENTER_FRAME, loaderF);
gotoAndPlay(2);
} else {
PreLoader.PreLoaderFill.scaleX = total;
PreLoader.PercentLoaded.text = Math.floor(total*100) + "%";
When I simulate a download, the preloader works fine in all the settings except for 'T1'. On this setting, the movie loads to about 20% then the preloader stops, the movie begins and I receive the following error message in the output panel:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FlashFront1_fla::MainTimeline/loaderF() .
The movie itself plays fine on all settings, including 'T1'. Debug doesn't report any issues on preloader or movie.
Can anybody give me any idea what the source of the issue is? Should I even be concerned about it givne that the movie plays without a problem?
My second question relates to the 'Simulate Download' pre-settings in Flash. I know their are people out there still on 56K dial-up, or with 'broadband' running at 500 KBS (in the UK at least), but nevertheless, the download simulation settings seem like they are all geared to internet as it was in 1997 and are hardly reflective of the capacity of modern connections. Why is this?
My movie is not large (about 320KB). Should I even be bothering with a preloader or am I wasting my time for a small minority audience (much like the web designers who still produce sites for the 12 people in the world still browsing in 800 x 600 res)?
Thanks for any help/advice.Flash movies stream down and finish "loading" when the first frame and content that loads on the first frame is available, though frame 1001 might not be downloaded yet. You would think you'd be kinda safe with frame 2 on a T1, but I think the issue is things aren't updating in the right order rather than things not really being downloaded. Heck, it could even just be the T1 simulation that's causing problems.
Debug Movie probably isn't showing issues because it slows the timing enough to make everything ok. You could try trace statements too to see how far the code gets.
Also, you might try a full scale AS3 loader like this one http://www.republicofcode.com/tutorials/flash/as3loader/
I've found the Event.COMPLETE listener for the loader like this:
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
to be pretty accurate so far in regards to content truly being loaded where as previous methods gave false positives for loading. -
AS3 rotation issue/bug need help.
Ok I have been converting a AS2 flash based sight to AS3. With the project I have to make new transitions for the pages. The client wants these transitions to be in 3d, which ive worked with before and have had no problems. However for the last few hours ive had this killer issue that wont go away.
When using rotationZ or rotationX on any element the rotation value is not based on 360 degrease but instead based on a random number. For example I can rotate a box on the stage by 0.03 and it will be ~rotated 180 degrease, but if I do the same rotation on another box on the stage it will go to ~40 degrease.
Im clueless to why this is happing and if I try to duplicate the error in another file it wont happen. So... anyone able to give me a heads up at what may be causing this?
For those asking how im rotating it.
box.rotationY = 45;
box2.rotationY = 90;Ok... heres the min code for the error to happen my side.
If you need an XML you can make your own to test this using the fallowing structer or just use this.
---------------------------- XML Bellow ------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xml>
<page>
<name value="Home"/>
<background value=""/>
<content type="text">Hello this is random text? what the hell? what the duce?</content>
<x value="400"/>
<y value="20"/>
<content type="image">url to the image file</content>
<x value="400"/>
<y value="20"/>
</page>
</xml>
-------------------------------- AS3 Bellow -----------------------------
package {
import com.greensock.*; // this is a tweening class dont worrie about it
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.geom.*;
public class sps extends MovieClip {
var PAGES:MovieClip = new MovieClip();
var p_url:String="sps.xml"; // this generates content for pages loads and works fine dont worrie about it
var p_loader:URLLoader = new URLLoader();
var PageList:XMLList;
var rdy:Boolean = false;
public function sps() {
setFormats();
loadPages();
init();
public function init() {
addChild(PAGES);
PAGES.rotationY = 60; // This is were the problem is!
public function setFormats() {
ntf.color=0xFFFFFF;
ntf.font="Tahoma";
ntf.size=12;
ntf.align="center";
ntf.bold=true;
ntf.rightMargin=ntf.leftMargin=10;
public function loadPages() {
function onComplete(e:Event) {
p_loader.removeEventListener(Event.COMPLETE, onComplete);
var xmlData:XML=new XML(e.target.data);
PageList=xmlData.children();
var i:Number=0;
while (i < PageList.length()) {
makePage(PageList[i], PAGES);
i+=1;
p_loader.load(new URLRequest(p_url));
p_loader.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
public function makePage(pd:XML, p:MovieClip) {
var page:MovieClip =new MovieClip();
var pageCon:MovieClip = new MovieClip();
var i:Number=0;
while (i < pd.content.length()) {
if (pd.content[i].attributes()=="text") {
newText(pageCon, pd.content[i], pd.x[i].attributes(), pd.y[i].attributes());
}else if (pd.content[i].attributes()=="image") {
newImage(pageCon, pd.content[i], pd.x[i].attributes(), pd.y[i].attributes());
}else if (pd.content[i].attributes()=="video") {
}else if (pd.content[i].attributes()=="music") {
}else if (pd.content[i].attributes()=="subpage") {
}else if (pd.content[i].attributes()=="slider") {
i += 1;
pageCon.x-=472.5;
p.addChild(pageCon);
pageCon.addChild(page);
public function newText(p:MovieClip, t:String, x:Number, y:Number) {
var tf:TextField = new TextField();
tf.text = t;
tf.x=x;
tf.y=y;
p.addChild(tf);
return tf;
public function newImage(p:MovieClip, u:String, x:Number, y:Number) {
var f:URLRequest = new URLRequest(u);
var i:MovieClip = new MovieClip();
var l:Loader = new Loader();
i.x=x;
i.y=y;
l.load(f);
p.addChild(i);
function ps (e:ProgressEvent){
function lr(e:Event){
l.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, ps);
l.contentLoaderInfo.removeEventListener(Event.COMPLETE, lr);
i.addChild(l);
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, ps);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, lr);
return i; -
Error #1009 - the most stupid AS3 loader issue ever !!!
Hi,
(It's about AS3 / Flash CS4)
As a developer I often have no controll what is the content of a movie being runtime-loaded. I must presume I have no control on it at all - movie clips are marketed and sold and the only thing expected is that they play nice. And they are supposed to be runtime-loaded by a simple "progress-bar" style loader.
The loader movie itself is fine. Though it's not sort of these tricky "no timeline, document-class only" it used to do the job.
The main code is as folllows:
FRAME 2:
var thisRequest:URLRequest = new URLRequest("movie.swf");
var thisLoader:Loader = new Loader();
var newContent:MovieClip;
thisLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoading);
function doneLoading(evt:Event):void{
newContent = MovieClip(thisLoader.content);
//stage.addChild(newContent); -- please notice I commented this line !!!
FRAME 3:
thisLoader.load(thisRequest);
As you may see, it's nothing special - just regular loader stuff here...
But the issue is that it throws errors just in case of some loaded SWFs.
Another words - the content and structure of movie.swf impact the loader performance!
Too often I notice this kind of error being thrown right after "thisLoader.load(thisRequest);" is execuded:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at movie_fla::MainTimeline/frame8()
Right after - that means BEFORE adding loaded movie to the Stage childlist etc.
I said - right after movie.swf is invoked by the "load" command !
This is really rediculous!
I do not expect this sort of behavior! I expect the loaded movie to be quiet unless explicitly added to stage with:
stage.addChild(newContent);
But in a contrary - it seems the loaded movie becomes somewhat active right after being loaded - even before being added to stage. And in some cases this prematured activity leads to hard-to-controll errors! Please notice the error is thrown despite line where loaded content is added to stage is commented!
I said what I wanted to say - now dear Flash AS3 experts and mastahakas please - give me some advice what to do in this situation.
I am really, really confused as I want to write clean, error-free code and I get run out of ideas how to deal with this nasty issue.
Rgs,
ZiggiYeap,
I found the solution:
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, initLoading);
function initLoading(e:Event){
newContent = MovieClip(thisLoader.content);
newContent.stop();
So, stopping the loaded movie in this handler do the job...
Stupid anyway! -
CS5.5 AS3 FLVPlayback issue adding to stage or library
I am unable to add the Action Script 3 FLVPlayback component to my stage or library in Flash CS5.5 when working with an action script 3 document.
Under components in the video folder i click and drag anyone of the FLVPlayback components (FLVPlayback, FLVPlayback 2.5 or FLVPlaybackCaptioning) to the stage and nothing happens. I am unable to add it to my library as well. All the other actionscript 3 components under the Video folder work. (BackButton, BufferingBar, CaptionButton, etc...)
If I create an actionscript 2 document the FLVPlayback component drags to the stage and adds to the library just fine. So this appears to be an actionscript 3 issue only.
I have 2 other employees in my office using the same product and none of them have this issue. Only me.
I have tried to uninstall the product and reinstall but nothing helps.
I have Flash CS3 installed on my PC and the product has the same symptoms as the Flash CS5.5 trial version that I am running.
I did not try this with Flash CS3 before I installed the CS5 trial. So I do not know if it worked prior to my CS5 evaluation.Microsoft Windows XP
Professional
Service Pack 3
Video component
Date Created: 3/17/2011
Date Modified: 3/17/2011
User folder
Not sure what you are asking for here.
Thanks for your assistance,
Message was edited by: jimder -
Install oracle golden gate 11.1.1.0 for oracle9i on RedHat AS3 U6 issue
Hi expert,
I need install Oracle golden gate base on below combination:
GG version: 11.1.1.0 (x64)
OS version: Redhat AS3 UL6 (x64)
Oracle version: 9.2.0.8 (x64)
I set the .bash_profile for oracle as below:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/9.2.0
export GGATE=/software/ogg
export PATH=$PATH:$ORACLE_HOME/bin:$GGATE
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$GGATE
However, after installation, when I run ggsci, it show below error message:
ggsci: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
I searched the libstdc++.so.6 in the server and found one in /lib64/ssa/libstdc++.so.6, I changed the LD_LIBRARY_PATH as:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$GGATE:/lib64/ssa/
then this time it has below error:
ggsci: /lib64/ssa/libstdc++.so.6: version `GLIBCXX_3.4' not found (required by ggsci)
ggsci: /lib64/ssa/libstdc++.so.6: version `GLIBCXX_3.4' not found (required by /software/ogg/libxerces-c.so.28)
my question:
1. Is GG 11.1.1.0 supported on RHEL AS3 U6? From oracle official website, it seems only the EL 4 UL7+ or EL 5 UL3+ are supported.
2. If it's supported, how to resolve above error?
Many thanks for your help.Hi,
I think GG version: 11.1.1.0 (x64) supports only oracle 10g and 11g databases.
Try GG version: 10.4.0.19 (x64) for oracle 9.2.0.8
Thanks. -
Can anyone explain why this happens? Just seems like an odd requirement to ensure accurate math.
set a to 12.0
set b to 9.6
set c to b / a
--c is 0.7999999999999999 instead of 0.8 (unless casted to string in next line)
--set c to (c as string) as real
if (c is 0.8) then
display dialog "c is 0.8"
else
display dialog c
end ifHello
My pleasure. Glad to know it helped.
Well, there's one line I'd like to retract in my example, for it is misleading, that is -
set a to 12.0
set b to 9.6
set c to b / a
return roundn(c, -10) = 0.8 -- => true
Indeed it returns true but it is only happy coincidence.
We must carefully avoid "raw" real numbers in any comparison and round the both operands except for literal integers. Such as -
return roundn(c, -15) = roundn(0.8, -15)
or preferrably for performance's sake -
return roundn(c - 0.8, -15) = 0.0
Here's some unhappy coincidence -
set x to 0.3 + 0.4
set y to 0.3 + 0.4
--return x = y -- => true
return roundn(x, -1) = y -- => false
--return roundn(x, -2) = y -- => false
--return roundn(x, -3) = y -- => false
--return roundn(x, -4) = y -- => false
--return roundn(x, -5) = y -- => false
--return roundn(x, -6) = y -- => true
--return roundn(x, -7) = y -- => true
--return roundn(x, -8) = y -- => false
--return roundn(x, -9) = y -- => false
--return roundn(x, -10) = y -- => false
--return roundn(x, -11) = y -- => true
--return roundn(x, -12) = y -- => true
--return roundn(x, -13) = y -- => false
--return roundn(x, -14) = y -- => true
--return roundn(x, -15) = y -- => false
--return roundn(x, -16) = y -- => true
--return roundn(x, -17) = y -- => true
--return roundn(x, -18) = y -- => true
--return roundn(x, -15) = roundn(y, -15) -- => true (trivial if x = y)
--return roundn(x - y, -15) = 0.0 -- => true (ditto)
on roundn(n, d)
number n : source number
integer d : target rounding place so that n is rounded to 10 ^ d's place
set h to 10 ^ d
(round n / h rounding to nearest) * h
end roundn
Let us tame the floating devils by proper rounding!
All the best,
H -
Hi,
I am having a issue with my main menu buttons. My buttons are controlled by AS. Here is the code I am using for the buttons.
//handle events for buttons...
home.addEventListener(MouseEvent.CLICK, clickSection);
design.addEventListener(MouseEvent.CLICK, clickSection);
photography.addEventListener(MouseEvent.CLICK, clickSection);
about.addEventListener(MouseEvent.CLICK, clickSection);
contact.addEventListener(MouseEvent.CLICK, clickSection);
company.addEventListener(MouseEvent.CLICK, clickSection);
function clickSection (evtObj:MouseEvent) {
//trace shows what's happening.. in the output window
trace ("The "+evtObj.target.name+" button was clicked!")
// go to the section clicked on...
gotoAndStop(evtObj.target.name);
The issue I am having is that say the user clicks on the Design button on the home page, the design button goes in to a page of company logos, the user then clicks on a companies logo to view the work that we have done for that company, a slide show of photographs opens when the user clicks on the company logo. The user click thru the photos. Here is the issue I am having. I want the user to be able to click on the main Design button to get back to the logos section, which is the start of the design section. If you are in my design section, the design button does not work, or reload the section. You have to, say, click on the contact button, then click on the design section again in order to start it over. I hope this makes sense, and that someone can help. My email is [email protected] if anyone thinks they can help.
Thank you.One of the approaches can be holding references to the clicked button and frame in wich the click occured. here may be bugs in the code - this is just a concept:
//handle events for buttons...
home.addEventListener(MouseEvent.CLICK, clickSection);
design.addEventListener(MouseEvent.CLICK, clickSection);
photography.addEventListener(MouseEvent.CLICK, clickSection);
about.addEventListener(MouseEvent.CLICK, clickSection);
contact.addEventListener(MouseEvent.CLICK, clickSection);
company.addEventListener(MouseEvent.CLICK, clickSection);
// currently clicked button
var currentClick:DisplayObject;
// return frame
var returnFrame:int = 0;
function clickSection (evtObj:MouseEvent) {
//trace shows what's happening.. in the output window
trace ("The "+evtObj.target.name+" button was clicked!")
// go to the section clicked on...
if (currentClick && evtObj.currentTarget == currentClick) {
currentClick = null;
gotoAndStop(returnFrame);
else {
gotoAndStop(evtObj.currentTarget.name);
currentClick = evtObj.currentTarget;
returnFrame = MovieClip(this).currentFrame; -
What is mean this words in as3
i am new to as3 please help me about this words and how can i use it
_root
Math.atan2
onEnterFrame
Math.sqrt
and the word " this " in as3
*and what is the difference between this words ?
_x and x
_xmouse and mouseX
_rotation and rotation_root (as2) = MovieClip(root) (as3)
Math.atan2 (as2) = Math.atan2 (as3)
onEnterFrame (as2) = addEventListener(Event.ENTER_FRAME,somefunction);
Math.sqrt (as2) = Math.sqrt (as3)
this (as2) = this (as3)
_x (as2) = x (as3)
_xmouse (as2) = mouseX (as3)
_rotation (as2) = rotation (as3) -
Confused about AS3 buttons (did read David Stiller's blog)
I'm trying to convert an AS2 file over to AS3 and I can't get
the buttons to work. They do not want to gotoAndStop at certain
frames in specific scenes. In the following code, if you click on a
button it works fine, but when you attemp to change to a new Scene,
it breaks and both buttons won't work thereafter. I've tried
everything for almost a day now and cannot get this to work and
cannot find any reference to the problem. Is AS3 buttons not able
to go to a new scene as it suggests in the Help files?:Laura,
> Old patterns, old habits...time to change.
Well, not necessarily! The old ways still work. :) Just
configure
your publish settings for AS2 or AS1, and bingo. It all
depends on what
you're trying to accomplish. If your aim is to output to TV,
then by all
means, use scenes! If you're not using code -- or using very
little code --
then it basically doesn't matter what version of ActionScript
you use.
> Now the flash animation drawing tools are so lame it's
just
> embarrassing. It's all about interactivity and coding is
essential.
I can hear that you're frustrated, and it probably helps to
vent (it
often helps me), but for the sake of others who might be
reading this
thread, I'm respectfully asking you for specifics. What new
animation
and/or drawing tools do you mean? How are they embarrasingly
bad?
The 3D and inverse kinematics (IK) tools, new to CS4, are
hardly
something I'd call embarrassing. On the contrary, they're
cool all hell!
True, the 3D tools require the FLA to be configured for AS3,
but no
scripting is required to use 3D or IK (though you *can*
script them if you
want to).
The blend modes and filter effects introduced in Flash 8
were a welcome
edition. They didn't hinder anyone's workflow, as far as I
know. If you
wanted to use them, great! If not, great! Improved text
rendering has been
a joy ... and again, use it or not -- the choice has always
been up to the
designer's whim.
> Ok, scenes are kinda old school. I can see why.
They're only problematic (speaking historically) in cahoots
with
ActionScript. Unlike some, I actually do endorse the use of
scenes ;) --
just not in the context of programming. Keep using old school
if that's
what works for you. If you like, experiment with the new
stuff as your
schedule allows.
> Why do anything in the timeline if you can do it in the
code?
I can't tell if you're being sarcastic in this line, but
either which
way, the answer (at least, from my perspective) is a
pragmatic one. Use the
timeline when doing so takes the least amount of work; the
reverse holds
true for code. There are plenty of animations --
specifically, character
animations, including lipsynch -- that, for me, are easier to
do by hand, by
direct manipulation of the symbols with my mouse and/or
graphics tablet.
I find it easier to design complex gradients using the
drawing tools. I
often find it easier to design complex tween eases by hand.
When I'm
working on animation, I tend not to code as often; when I'm
building a
Flash-based website, it's likely to be a combination of
timeline techniques
and code; when I'm writing applications, it's obviously a
case of
mostly-code.
> [code gives you] more control. It can be more dynamic
and
> flexable. It is easier to edit. Next I need to do more
external
> .as doc scripting.
Writing custom classes is another layer of technique.
Depending on your
workflow, it may or may not be useful. For what it's worth, I
wrote a
tutorial series for Community MX not so very long ago that
might help
illustrate this point ...
http://www.communitymx.com/abstract.cfm?cid=ECBF0
... the first article is free, and demonstrates a technique
(using code) for
causing letters to wiggle into place. Over the course of
several
installments, this series works toward moving the code from
the timeline to
a class file, which shows how custom classes can provide a
workflow boost,
even for a movie that doesn't necessarily need to be
übercoded in other
respects. I hasten to add, I'm not one who relishes the role
of a "Here,
the first one is free" salesman, so be aware that you can
also read the
remaining articles free if you sign up for a trial
membership, which you can
cancel without obligation in a week's time.
> My working file is now all on a single timeline with no
scenes.
> Who needs scenes. Yipee!
Under the hood (meaning, in the SWF) all those scenes are
ultimately
converted to one big timeline anyway. Granted, the use of
scenes is a
convenient organizational tool during authoring, and I don't
deny that
scenes-with-ActionScript would be equally convenient, but
again ... scenes
have been "broken" in ActionScript for a long time. It looked
like Flash
CS3's AS3 finally resurrected the workflow, and -- for the
time being -- it
looks like CS4 might somehow be missing the mark. If so, as
kglad proposes,
the AS3 gotoAndPlay() issue is a bug in CS4, and we can hope
for a fix from
Adobe.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
I have been working on and off with advanced material in vector and tensor space, grad level math
anyway I was looking at error correcting code and noticed BCH as being a generalization over ideas like parity etc.
The syndrome is computed as a vector of
f(j) = (a_0)^j + (a_2)^j + ... + (a_s)^j
for odd i from 1 do d-1, where a_i is the i-th component
for some vector a
remember that f(2j) is simply the square of f(j))
Because in C++ we number from 0, f(j) will reside in location (j-1)/2
Let m=GF2E::degree() (i.e., the field is GF(2^m))
assume d is odd and greater than 1, and less than 2^m (else BCH codes don't make sense)
Place your rig specifics into your signature like I have, makes it 100x easier!
Hardcore Games Legendary is the Only Way to Play!
Vegan Advocate How can you be an environmentalist and still eat meat?Hi Vegan,
Thanks for posting in VC++ forum.
VC++ forum aims to discuss and ask questions about the Visual C++ IDE, libraries, samples, tools, setup, and Windows programming using MFC and ATL.
This issue is not proper here. It is more related to math issue.
May
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
So, how much space do I actually have available?
OK, so I have my new MacBook Air with a 256 GB SSD and I have been using it for a fortnight or so.
One thing that perplexes me is that I am getting different values for the available space left on the SSD and it is a little confusing. The system, of course, is running OS X 10.7 Lion, but I just don't know if this is a MBA, SSD, OSX or just plain old maths issues!
In the Finder, I am told I have 123.44 GB available ...
In PathFinder, I am told I have 108.6 GB available ...
In Disk Utility, I am also told the same as PathFinder, that I have 108.64 GB available ...
And finally, Terminal (and using df -h) tells me something else (although this is probably a base 2 issue), that I have 101 GB free.
So, which one is right?!
Thanks,
Sambranchespark wrote:
And finally, Terminal (and using df -h) tells me something else (although this is probably a base 2 issue), that I have 101 GB free.
Try
df -H
for GB output -
I can't work out how to create an array of textfields and
populate a container with them. I'm using AS3 but it may not be as3
specific issue. Creating the array of textfields is the problem,
the rest (addChild, x,y) should be ok.I'm not sure if it's the same is AS3, but in AS2 you can use
an for...in loop to find all the TextFields and put them into an
Array (replace "this" with the MovieClip/Sprite to search for
TextFields):
for (var a:String in this)
if (this[a] instanceof TextField) textFields.push(this[a]);
Hope that helps!
Mesmotronic Multiuser Server for Flash 1.0 available now!
http://www.multiuserserver.com/ -
Labview 2010 can't add or subtract
Hi there. im having a problem with labview 2010. im not sure why and it is really weird.i have this for loop which i want to run for n-3 times where n is an array size. so i wire to the N of the for loop the output of the subtract operator and in the inputs of the subtract i put the array size and the 3 constant. but instead of giving me the result it alway gives me a -3. no matter what the size of the array is, the subtract operator always returns a -3. i tried replacing it for an add operator but it just gave me a +3 instead of a -3. so the for never executes. i tried recompiling it and deleting and redrawing the diagram with no success. i know it is a labview 2010 error cause i saved it for a previous version (8.6) and run it on another labview and it did the subtract correctly. here is the screenshot. i ran out of ideas any guesses? im downloading the service pack 1 to see if that helps. thanks in advance.
Attachments:
error.jpg 63 KBI agree with the above 2 posts.
I've never had math issues with LabVIEW.
My LV 2010 works well when trying what you described. See below:
Attachments:
goodMath.png 24 KB -
Hi,
I am trying to implement a simple image gallery with alpha transition using as3. But an issue is occuring with this. After each image alpha transition, the stage becomes blank. The code i have used for image Gallery is following.CAn anybody help me. I am trying this for a week. but still i have a hope for make this working. So please help me.
import flash.display.Loader;
import flash.display.*;
import gs.TweenLite;
const TIMER_DELAY = 2000;
var totImages:Number;
var index:Number = 0;
var imgArr:Array = new Array();
var currentContainer:MovieClip = holder0;
currentContainer.alpha = 0;
var transTimer:Timer = new Timer(TIMER_DELAY);
//transTimer.addEventListener(TimerEvent.TIMER, startTransition);
var imgLoader:Loader = new Loader();
var myXML:XML = new XML();
var XML_URL:String = "images.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void{
myXML = XML(myLoader.data);
processXML(myXML);
function processXML(xml){
totImages = xml.children().length();
for(var i=0;i<totImages;i++){
var tempVar = xml..item[i]..image;
imgArr.push(tempVar);
//transTimer.start();
currentContainer = holder0;
loadImage();
function loadImage(){
var url = imgArr[index];
//ImgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeInImg);
var fileRequest:URLRequest = new URLRequest(url);
imgLoader.load(fileRequest);
currentContainer.addChild(imgLoader);
function fadeInImg(e:Event){
TweenLite.to(currentContainer,3,{alpha:1,delay:2,onComplete:switchClip});
function switchClip(){
if(index < totImages){
index++;
} else {
index = 0;
if(currentContainer == holder0){
currentContainer = holder1;
} else {
currentContainer = holder0;
currentContainer.alpha = 0;
MovieClip(this.root).swapChildren(holder0, holder1);
loadImage();
Thanks and Regards,
SreelashHi Adrei, I have implemented the thumbnail button also. Its working but the problem is that thumbnail buttons and controls are placing behind the image container. How can i place the thumbnail buttons and control buttons over the image. You can view the result in the following url:
http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/scrllGallAnd.html
The working swf is with the following url:
http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/scrllGall.html
The code that i used for creating thumbnail is following
import flash.display.DisplayObject;
import flash.display.*;
import flash.display.Loader;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.text.*;
import flash.net.*;
import flash.utils.Timer;
import gs.TweenLite;
import gs.easing.*;
var xmlURL:String = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test1/images.xml";
var loadedImages:Array = [];
var imageURLs:Array = [];
var thumbArr:Array = [];
var imageLoader:Loader;
var prevImage:DisplayObject;
var currentImage:DisplayObject;
var thumbContainer:MovieClip;
var currThumb:MovieClip;
var prevThumb:MovieClip = null;
var showTimer:Timer;
var timerDuration:int = 5000;
var tweenDuration:int = 2;
var currentIndex:int = 0;
var activIndx:Number = 0;
var slidesHolder:Sprite;
var prvFlag:Boolean = false;
var nxtFlag:Boolean = false;
var twnFlag:Boolean = false;
var rt_lt_Flag:Boolean = true;
var myXMLURL:URLRequest = new URLRequest(xmlURL);
var xmlLoader:URLLoader = new URLLoader(myXMLURL);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(myXMLURL);
var a:int = 90;
ctrlBox.btnPlay.buttonMode = true;
ctrlBox.nextImg.buttonMode = true;
ctrlBox.prevBtn.buttonMode = true;
ctrlBox.btnPause.buttonMode = true;
ctrlBox.btnPlay.visible = false;
ctrlBox.btnPause.addEventListener(MouseEvent.CLICK,stopScroll);
ctrlBox.btnPlay.addEventListener(MouseEvent.CLICK,startScroll);
ctrlBox.nextImg.addEventListener(MouseEvent.CLICK,shwNext);
ctrlBox.prevBtn.addEventListener(MouseEvent.CLICK,shwPrev);
function xmlLoaded(e:Event):void {
var a:int = 45;
e.target.removeEventListener(Event.COMPLETE, xmlLoaded);
processXML(XML(e.target.data));
function processXML(xml:XML):void {
var len:int = xml.children().length();
var tempVar:String;
for (var i:int = 0; i < len; i++) {
tempVar = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test1/" + xml..item[i]..image;
//trace(tempVar)
imageURLs.push(tempVar);
preload();
createThumbs();
function createThumbs():void{
thumbContainer = new MovieClip();
addChild(thumbContainer);
for(var i:int=0;i<9;i++){
var thmbHolder:MovieClip = new MovieClip();
thumbContainer.addChild(thmbHolder);
//MovieClip(this.root).swapChildren(currentImage, ctrlBox);
thmbHolder.buttonMode = true;
var thmb:thumbClass = new thumbClass();
thmbHolder.addChild(thmb);
thumbArr.push(thmbHolder);
thmbHolder.name = i.toString();
thmb.imgNum.text = (i+1).toString();
thmbHolder.addEventListener(MouseEvent.CLICK,showImage)
//trace(thmb.imgNum.text)
thmbHolder.x = i*(thmbHolder.width+5)+5;
thumbContainer.y = stage.stageHeight - thumbContainer.height;
function showImage(e:MouseEvent):void{
var imgIndx:Number = e.target.parent.parent.name;
prevThumb = currThumb;
currThumb = e.target.parent.parent;
currThumb.buttonMode = false;
if(activIndx != imgIndx){
prevThumb.buttonMode = true;
currentIndex = imgIndx-1;
shwNext(null);
activIndx = imgIndx;
} else {
stopScroll(null);
function preload():void{
var len:int = imageURLs.length;
for (var i:int = 0; i < len; i++) {
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPreloadComplete);
loadedImages.push(imageLoader);
imageLoader.load(new URLRequest(imageURLs[i]));
function onPreloadComplete(e:Event):void {
e.target.removeEventListener(Event.COMPLETE, onPreloadComplete);
if (!showTimer && loadedImages[0].content && loadedImages[1].content ) startShow();
function startShow():void{
currentImage = loadedImages[0];
currentImage.alpha = 0;
slidesHolder = new Sprite();
var slideMask:Sprite = new Sprite();
var gr:Graphics = slideMask.graphics;
gr.beginFill(0xff0000);
gr.drawRect(0, 0, currentImage.width, currentImage.height);
gr.endFill();
addChild(slidesHolder);
addChild(slideMask);
slidesHolder.x = slideMask.x = 0;
slidesHolder.y = slideMask.y = 0;
slidesHolder.mask = slideMask;
slidesHolder.addChild(currentImage);
TweenLite.to(currentImage, 10, { alpha: 1 } );
showTimer = new Timer(timerDuration);
showTimer.addEventListener(TimerEvent.TIMER, slideTransition);
showTimer.start();
function slideTransition(e:TimerEvent):void{
var nextImage:int;
if(rt_lt_Flag == true){
if(nxtFlag == true){
showTimer.stop();
nxtFlag = false;
nextImage = currentIndex < loadedImages.length - 1 ? currentIndex + 1 : 0;
if (loadedImages[nextImage].content) {
currentIndex = nextImage;
loadedImages[currentIndex].x = slidesHolder.width;
slidesHolder.addChildAt(loadedImages[currentIndex], slidesHolder.getChildIndex(currentImage));
prevImage = currentImage;
currentImage = loadedImages[currentIndex];
showCurrent();
} else {
if(prvFlag == true){
showTimer.stop();
prvFlag = false;
nextImage = currentIndex > 0 ? currentIndex - 1 : loadedImages.length - 1;
if (loadedImages[nextImage].content) {
currentIndex = nextImage;
loadedImages[currentIndex].x = -(stage.stageWidth);
slidesHolder.addChildAt(loadedImages[currentIndex], slidesHolder.getChildIndex(currentImage));
prevImage = currentImage;
currentImage = loadedImages[currentIndex];
showCurrent();
activIndx = currentIndex;
//trace(currentIndex)
function showCurrent():void{
// make sure they have proper alphas
//prevImage.alpha = 1;
//currentImage.alpha = 0;
//TweenLite.to(prevImage, tweenDuration, { x: -slidesHolder.width } );
twnFlag = true;
if(rt_lt_Flag == true){
TweenLite.to(currentImage, tweenDuration, { x: 0, onUpdate:onTweenProgress, onComplete: removePrevious } );
} else {
TweenLite.to(currentImage, tweenDuration, { x: 0, onUpdate:onTweenProgress, onComplete: removePrevious } );
function onTweenProgress():void{
if(rt_lt_Flag == true){
prevImage.x = currentImage.x - prevImage.width;
} else {
prevImage.x = currentImage.x + prevImage.width;
function removePrevious():void {
if (slidesHolder.contains(prevImage)) slidesHolder.removeChild(prevImage);
twnFlag = false;
function stopScroll(e:MouseEvent):void{
ctrlBox.btnPlay.visible = true;
ctrlBox.btnPause.visible = false;
showTimer.stop();
function startScroll(e:MouseEvent):void{
rt_lt_Flag = true;
ctrlBox.btnPlay.visible = false;
ctrlBox.btnPause.visible = true;
resetListener(timerDuration=5000,tweenDuration=2)
function shwNext(e:MouseEvent):void{
if(twnFlag == false){
rt_lt_Flag = true;
stopScroll(null);
nxtFlag = true;
resetListener(timerDuration=0,tweenDuration=1)
function shwPrev(e:MouseEvent):void{
if(twnFlag == false){
rt_lt_Flag = false;
stopScroll(null);
prvFlag = true;
resetListener(timerDuration=0,tweenDuration=1)
function resetListener(timerDuration,tweenDuration){
showTimer.removeEventListener(TimerEvent.TIMER, slideTransition);
showTimer = new Timer(timerDuration);
showTimer.addEventListener(TimerEvent.TIMER, slideTransition);
showTimer.start();
Can you help me on how can i swap the depth of images and control buttons.
Thanks and regards,
Sreelash
Maybe you are looking for
-
T400 with ATI Radeon HD 3400. Driver not found after running ImageX.exe /Capture
Hello, I was able to reproduce the following problem on a T400. - unattended installation of WXP-SP3 (slipstreamed) - reboot - install latest ATI driver from Lenovo/IBM site (8.503.2.2-080818a-069536C) - reboot At this point, the video driver is well
-
What can I do without redownloading the songs, since I don't have access to the first computer right now?
-
Hi gurus, I am posting a d docoment in F-33 , Sbi Bill Discounting. Iam getting an error - *account 400400 requires an assignment to a co object.* while practising FI iam getting this error. how to remove co element in fi settings. plz suggest me. re
-
How to send dashboard html & attachment in a single i-bot
Hello friends, I have two questions. 1.Is it possible to send the multiple reports in a single i-bot? For example: I have two reports A & B. I want to send it in a single mail (i-Bot) 2.Is it possible to send the report as both HTML & attachment? For
-
How to create a 2-color job in PageMaker?
how to create a 2-color job in PageMaker?