Flash :: Nullify Object Passed To A Function?
Oct 5, 2010I have the following problem with objects in actionscript3:
var o:Object = new Object();
destroyObject(o);
trace(o); // [object Object]
[code].....
I have the following problem with objects in actionscript3:
var o:Object = new Object();
destroyObject(o);
trace(o); // [object Object]
[code].....
In my case I have 6 movieclips and 6 corresponding text fields (all 12 objects are on the main timeline) and the movieclips are named thumb1_mc, thumb2_mc, etcetc, and the text fields are named text1, text2, etcetc.I have a method:mcl_mcl.onLoadProgress = function (targetMC, loadedBytes, totalBytes)in which I need to change the appropriate text file's text depending on which movieclip is targetMC.The trouble is I can't find a way to distinguish which mc it is, so I can't pick which text file to change.I tried using properties but that doesnt work because everything about the movieclip gets obliterated the moment I load something into them.
View 4 RepliesHaving this simple [code]...
Why the function nullify() changes the value of the property "a" but doesn't do the "= null " assigment to the object passed by parameter ?
Basically I want Javascript to pass a variable to Flash according to resolution. I realize my syntax might be off, but something like:
HTML Code:
<script type="text/javascript" language="javascript">
if (screen.width <= 800) {
expand = "false";
[code]....
Trouble is, I'm not sure what to do from here. I don't know exactly what I need to put in the <param> and <embed> tags, and how Flash would detect if the variable was true or not.
I have a basic XML file and a parser in as3.
So far, I can get it to parse and trace data from the xml file:
{
xml = new XML(e.target.data);
var tester = xml.item;
[Code].....
My objective is to pass in a bunch of variables from my XML file that I can use anywhere in the flash project.
why is my variable not being passed into my function?
Code:
dealerLocate.urlButton.linkButton.onRelease=function(webAddress){
web=webAddress
trace("this is web "+web);
[Code]....
the webAddress variable is from the exact same timeline making it one level up from this function. it traces out correctly too so I know the variable is there... just not getting passed!
My code seems to produce an error (7 times - same code) "1120: Access of undefined property xmlMarker." This appears on all occasions where the variable 'xmlMarker' is called outside of the function ('showData') where it was first produced.
Code:
stop();
var placesXML:XML =
<places>[code]............
I have a feeling that I shouldn't refer to the variable as a 'MovieClip', but I am unsure what else to pu thee if that is where the fault lies.On the stage there are several buttons relating to the place names attributes (works perfectly), dependent upon which button is pressed, the scene then jumps to a frame (again this works well), however within that frame there will either be 'myMarker_mc', or myMarker_mc2' (this does not work!).
I've got this code:
Code:
function func2(options:Object)
{
...
}
[code].....
-which doesn't seem to work.
In c++ if I have a function that takes a class I have defined elsewhere as a parameter like so:void moveto(CPoint2D point) { ... }I can invoke it and pass along data to it like this:moveto(CPoint2D(0,0));basically creating the object and invoking it's constructor to be passed to the functionIs there an equivalent to this in AS3?if I have a function like this:function initialize(min:Point, max:Point): void { ... }how do I do something along the lines of :initialize(Point(0,0), Point(10,10))This throws an error im assuming because it thinks I want to cast something to a point and the notation I found earlier to do something similar only seemed to work if using the basic Object class.
View 1 RepliesHow can you change the interval passed to the setInterval function?
I've tried for hours but it seems to trigger the function a million times.[code]...
I have a flash movie on my index page but as the user navigates through the site and then goes back to the home page, I don't want the intro to replay. I have fixed that using shared object so that if it has already played, it skips to the end of the animation...here is my code:
function VisitCheck() {
var myLocalSO = sharedobject.getLocal("visitRecord");
if (myLocalSO.data.visited == null) {
myLocalSO.data.visited = 1;
gotoAndPlay(3);
trace("visit 1");
} else {
gotoAndPlay(2);
trace("visit2");
}}
VisitCheck();
Works great, except now, the intro animation on the index page NEVER plays again; I would rather have the cookie expire after the user closes the window or a certain amount of time has passed (say 30 minutes).
regarding DOM object name/id updates by JavaScript, and accessing them from flash. Let me explain.
I have made an actionscript that tests if externalinterface.objectid is null. If it is, I call a JavaScript that gives names/id to all unnamed shockwawe-type <EMBED> and <OBJECT> tags.
My problem is that, although the Javascript does what it is supposed to, the SWF's ExternalInterface.objectID property remains null.
In other words, although the DOM is properly updated, that update is not propagated to the ExternalInterface object.
- Is this normal ?
- Can I "reconsctruct" the ExternalInterface object to have it updated too ?
- Could I have my SWF reload itself, and how?
- More generally, what should I be doing to be able to access the newly JS-modified id from my SWF movie ?
I'm trying to understand how the Flex framework draws objects (Button, Label, Image, etc.). The Button class seems to draw itself by addChild()ing its ProgrammaticSkin. However, where in the framework is the Graphics object being passed around in the hierarchy to achieve the drawing. I want to get to the level of 2D API.
View 1 RepliesI need to get variables that are passed from my html object and/or embed tags, so I can use them in my flash project.
for example: src="/incl/flash/Line_Graph.swf?a=value1&id=1"
how can I get a and id inside my flash file?
Is this a valid way to completely clean up a variable/object event listener (code abbreviated for sake of example):
Code:
private var _timing:Timing;
...
[code]......
In a 'for loop' I'd like to add an event listener to a series of buttons. For each button I'd like to define a different function. Is it possible to pass the variable through when the functions are being named? My buttons all have sequentially named instance names.Here's my code:
for (var cBut:int = 1; cBut < 4; cBut++)
{
this["c" + cBut].addEventListener(MouseEvent.CLICK, ["orangeValue" + cBut]);
}
And the resulting error:
TypeError: Error #1034: Type Coercion failed: cannot convert []@42f50a89 to Function.
I have a flash file that I am trying to debug. It loads a second flash file which it passes data to, and then that data is sent to a server. Unfortunately the data isnt coming out how it should.
I would like to know if anyone knows of a way to see what data is being passed to the embeded flash file from the original flash file. I need to make sure the data going to it is correct.
does anyone know how to encrypt the parameters that are passed to a flash movie? The case is, that the user should not be able to read the parameters in the source code in plaintext.
View 2 RepliesI've created a simple script in PHP for retrieve the list of files contained in a directory. After that, i need to pass the "lista" variable to ActionScript.
Code:
<?php
$ourDir = "./";
$ourDirList = scandir($ourDir);
[code]....
I am getting questions from the database (just text) and then passing them to flash via flash vars.I want one question to be displayed then the user will answer (text) and click a button and then the next question will be displayed for them to answer and so on.I am not hoping for overly specific advice but as I am very new to flash/actionscript am just looking for broad advice (or links ?) on how to approach this. Can I do it all from one frame just using actionscript?I think what I am really after (assuming I am not way off track) is if all the questions should be handled at once which I guess will require some kind of loop that listens for some buttonclick event to move to the next question ..... or be 'reloading' the flash movie and dealing with only 1 question at a time.
View 2 Repliesis it possible in flash that from an xml, a hexadecimal value of a certain color is passed to flash and be displayed as a background or text color.This colors are set by the users and it's just that the colors are passed into flash and i will display it in my movie as a background color or text color?is that possible in flash?if yes, how would i do this? please give me some samples or sites where i could see some samples.If not, is there any workaround for this? -- i'm thinkin by css but that's too troublesome..
View 1 RepliesI'm basically trying to extract a series of variables that are passed in URL from another flash movie. I have researched flash vars and the like and didnt really get far.[code]I was able to get the URL into Flash!So flash now has a variable called "section" that holds a string like this.url...My question is; how do i get the values held in each of these days, weeks, years, etc into a format that can be used with in the flash movie. Ideally into seperate variables where the values can be returned in a textbox.
View 1 RepliesI've noticed that some programmers animate objects based on the difference in time. I am not sure why or even if this is logical. Does anyone know the significance? Below is a snippet of code that explains what I mean:
[Code]....
If I want to measure the amount of time that has passed in as3 between method calls. Is the highest resolution from:
var now:Number = new Date().getTime();
I need to display a word passed to the flash movie through flashvars. My objective is to display this word centered inside a black rectangle which length adapts to the word length. The box should be on top of everything, aligned with the right margin of the Flash Movie and 100px from the top margin.
View 6 RepliesMy employer is making a flash card and they want to customize it by passing a variable in the url that links to the card in order to fill in a dynamic text box.So the URL will have ?me=Bob on the end to but Bob's name inside the card.I've done this for them in the past but that was AS2 and I'm trying to use AS3 for this card. oward a code snippet or tutorial on the best way to accomplish this. If we could use an embedded font that would be a bonus.
View 3 Repliespackage {
import flash.display.;
import flash.events.;
[code]....
i use Adobe flash player in my site, and now i need to increment some filed in database, when user click on player.here is the script
<div id="conteiner" style="text-align: center;" ></div>
<script type="text/javascript">
var s1 = new SWFObject("player.swf","ply","420","380","9","#FFFFFF");[code]...
i deside to use ajax for it, but how can i write a function in the flash object?
UPDATE: i only have the swfobject.js file, which contains such data
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new [code]....
and the player.swf, and the html, i've shown allready. i don't now is this flash player or no, and what can i do?
Below is my AS3 code:
[Code]...
If I run add('movie123'). How do I get the string 'movie123' in the enter_frame_handler function? UPDATE This forum post (Click Here) describes the issues I am having but doesn't provide the solution I am looking for. Luckily @kapep provided a simple solution that solved the issue.
How can I get the name out of the passed variable to the function?
for example:
Code:
drawArea(auto); //auto is a MovieClip();
private function drawArea(m:MovieClip):void {
m.graphics.beginFill(0xFF0000, 0.1);
[Code].....