Function To Pass Text As Parameter In Tooltip
Hi i have a code to show a tooltip and it works perfectly
b101.onRollOver = function() {
myToolTip.maxAlpha = 100;
myToolTip.colorTransform(100, 50, 100, 100, 100, 20, 100, 0);
myToolTip.show("Some text of the tooltip");
};
But i want to simplify the code because i have a lot of buttons i tried
function toolTip(text_tooltip){
myToolTip.maxAlpha = 100;
myToolTip.colorTransform(100, 50, 100, 100, 100, 20, 100, 0);
myToolTip.show(text_tooltip);
}
b101.onRollOver = toolTip("Some text of the tooltip")
But it didn't work, can anyone help me .
Thanks.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 08-22-2008, 10:10 PM
View Complete Forum Thread with Replies
Sponsored Links:
Rror With Function To Pass Text Parameter To A Tooltip Please Help
Hi i have a code to show a tooltip and it works perfectly
b101.onRollOver = function() {
myToolTip.maxAlpha = 100;
myToolTip.colorTransform(100, 50, 100, 100, 100, 20, 100, 0);
myToolTip.show("Some text of the tooltip");
};
But i want to simplify the code because i have a lot of buttons i tried
function toolTip(text_tooltip){
myToolTip.maxAlpha = 100;
myToolTip.colorTransform(100, 50, 100, 100, 100, 20, 100, 0);
myToolTip.show(text_tooltip);
}
b101.onRollOver = toolTip("Some text of the tooltip")
But it didn't work, can anyone help me .
Thanks.
View Replies !
View Related
Pass A Parameter To A Function
Hi,
I'm trying to simplify the code below. I'm sure this is something simple for the smarter-guys but it's bugging me... here goes.
//////////code begin///////////
function bday(myAge:Number, myName:String):Void{
trace("happy bday "+myName+". You are "+myAge+"years old.");
}
//first i wrote this, but this does not seem 'proper', eventhough it works great
myButton.onRelease=function(){bday(35,"Duncan");};
//however if i try to write the line below, the function executes when the swf compiles and loads. what am i doing wrong?
myButton.onRelease=bday(35,"Duncan");
//////////code end////////////
any help would be appreciated.
View Replies !
View Related
How Can I Pass A TYPE As A Parameter Of A Function
PHP Code:
public function SeatMe(manager:IManager):void
{
/*if (manager is IAssetManager)
{
if ( _assetManager == null)
{
_assetManager = manager as IAssetManager;
}
else
{
throw new Error("Waiter.CanYou.SeatMe()::I am sorry sir, but Mr. Asset Manager already exists");
}
}
if (manager is IWorldManager)
{
if (_worldManager == null)
{
_worldManager = manager as IWorldManager;
}
}*/
if (checkTypeManager(manager, _assetManager, IAssetManager, "Asset Manager"))
{ }
else if (checkTypeManager(manager, _worldManager, IWorldManager, "World Manager"))
{ }
else
{
throw new Error("Waiter.CanYou.SeatMe()::I'm sorry sir, but we don't allow you kind here");
}
}
private function checkTypeManager(manager:IManager, targetStaticManager:IManager, targetType:Class, targetString:String):Boolean
{
var result:Boolean = false;
if (manager is targetType)
{
if (targetStaticManager == null)
{
result = true;
targetStaticManager = manager as (targetType as Class);
}
else
{
throw new Error("Waiter.CanYou.SeatMe()::I'm sorry sire, but " + targetString + " already exists");
}
}
return result;
}
Hey guys I wante to be able to take the code in the comments ( if its a type of manager then set it to var )
and make a general function to handle this process. Is it possible? Below my comments is a general solution I envisioned.
thanks again ^_^
View Replies !
View Related
Trying To Pass Parameter/argument From Function In Nested Swf
thanks for reading.
I've got a loaded swf that calls a function in the root timeline, but I need the function call to "identify" itself because it could be one of 20 swfs calling the function,
the loaded swf says (after playing it's timeline):
Code:
playNext(image2);
and the function on the root timeline it's talking to:
Code:
_global.playNext = function (id)
{
currentMovie = "images/" + id + ".swf";
_root.imagesMc.loadMovie(currentMovie);
};
but this isn't working... It says id = undefined!?
How can I get these two to communicate please?
Thanks again.
View Replies !
View Related
Can I Pass A Class Type As A Function Parameter?
So, in AS2, I had a function that would create different movieclips based on variables I passed in (because attachMovie() took the name of the movieclip as a string - e.g. attachMovie("man",...) or attachMovie ("car"...)).
In AS3, it's done more correctly now, with a var mc = new Man() or new Car().
Is there a way for me to pass the class type (Man or Car) as a function parameter to a function:
e.g.
public function MakeMovieClip(classType:<something>):MovieClip {
return new classType();
}
or do I need to basically make a giant switch/case block that switches based on strings (which is what I'm currently doing)?
Thanks,
--
Ken
View Replies !
View Related
Can I Call A Function In My SWF And Pass It A Parameter From JavaScript In The Page?
Hello.
I'm trying to call a function in frame 1 of my SWF and also pass it a parameter.
I need to do this from elsewhere on the embedding HTML page using JavaScript.
For example call the function flashFunction(foo);
Does this require a listener in Flash that listens for the call, excepts "foo" and then calls the flashFunction and passes "foo" to it?
Can this be called directly without a listener?
Can this be done at all?
Any help would be greatly appreciated.
// jOEL
View Replies !
View Related
Can I Call A Function In My SWF And Pass It A Parameter From JavaScript In The Page?
Hello.
I'm trying to call a function in frame 1 of my SWF and also pass it a parameter.
I need to do this from elsewhere on the embedding HTML page using JavaScript.
For example call the function flashFunction(foo);
Does this require a listener in Flash that listens for the call, excepts "foo" and then calls the flashFunction and passes "foo" to it?
Can this be called directly without a listener?
Can this be done at all?
Any help would be greatly appreciated.
// jOEL
View Replies !
View Related
Can I Call A Function In My SWF And Pass It A Parameter From JavaScript In The Page?
Hello.
I'm trying to call a function in frame 1 of my SWF and also pass it a parameter.
I need to do this from elsewhere on the embedding HTML page using JavaScript.
For example call the function flashFunction(foo);
Does this require a listener in Flash that listens for the call, excepts "foo" and then calls the flashFunction and passes "foo" to it?
Can this be called directly without a listener?
Can this be done at all?
Any help would be greatly appreciated.
// jOEL
View Replies !
View Related
Can I Pass Text As Varable/parameter To Animated Text?
Hi,
I'm able to pass text as a varaible into a Flash text object and it changes the display dynamically.
But, can I do this for text that is animated? As I understand it, once text is animated it goes from being a text object to a symbol or movie? Can I change what is being animated somehow?
Thanks!
Ron Cook
Boulder, CO
View Replies !
View Related
How Do You Pass Variable Into Tooltip Component
I can't seem to figure out how to take a variable (vPhoto) and make the MM tooltips component read it. It just says "vPhoto" and never gets the value. I tried typing {vPhoto}, /vPhoto/, etc. Is there a way to do this? I can't find documentation on the tooltip to override the parameter interface...Help!
Doug
View Replies !
View Related
Url As A Parameter For A Function Loading From A Database / Text File
Here is one for those of us who are trying to put links into our text files - I have done this successfully, but am now putting the links into a filemaker database and am calling them as i would from a text file.
My question is this - i know that i can only pass one variable within a link that references a function within flash itself
Can i pass a url as my parameter? - like this
<a href="asfunction:loadAlbums,http://www.somedomain.com/somefolder/file...etc.">Click here</a>
i am haviong no luck in doing this at all
Basically i am brining in a list of bands for my cd collection, and am then wanting to pass the parameter of what url to call to find a list of albums relative to the band name chosen.
I have a function in flash that reads
function loadAlbums (encode2) {
_root.but1.info_container.albumclip._visible=true;
loadVariables (encode2, _root.but1.info_container.albumclip);
}
am i right in thinking that the parameter will pass to the function automatically when i click a band of my choice?
Sorry for all the explanation, my 2 questions are
1. Can you pass a url as a parameter to a function
2. Is my function written properly - i think it is.
Thanks in advance.
View Replies !
View Related
How Would I Pass A Parameter...
How would I pass a parameter (or any method) into a scrolling text box?
The parameter would come from a .jsp file. It would function exactly like an <iframe>
It would work like this.... (I run a affiliate program)
I send out an email to my clients with new links.
The problem is some 1000 of my clients have Yahoo and Hotmail accounts, and both services will replace my links with theres. So I will create a flash text box that will be independent of those meddlesome kids.
When the email is delivered it calls the flash file which in turn fills the text boxes with dyn. data. And my clients cut and paste the untouched code into there pages.
View Replies !
View Related
ClearInterval AND Pass Parameter
Hi all, I was curious if it's possible to pass a parameter to the clearInterval() method. For instance, this is what I am wanting to do:
*************** = function(objSize, intID) {
if (frame_mc._yscale >= objSize) {
trace("frame is scaled accordingly");
clearInterval(intID);
}
}
My setInterval is setup as such (passing the two parameters):
id1 = setInterval(***************, 2000, 39950, "id1");
My issue is, I'm positive my clearInterval is not working because it's try to clear a "intID" setInterval object, instead of the parameter. However, I'm not sure how to correctly syntax my parameter within the clearInterval.
I'm sure this is a very simple thing. However, I'm stuck...any suggestions are appreciated!
thanks,
nick
View Replies !
View Related
Pass Parameter GotoAndPlay
I'm trying to pass a parameter and input it into gotoAndPlay.
Below is my code... The trace on the numVar works and traces fine.
The problem is when it gets to this actionScript on frame 91
_root.gotoAndPlay(numVar);
It won't do anything
Please help!!!! been working on this for hr's trying to get it
I'm using MX 2004
// on frame 60 :::
stop();
function frameFunction(frameParameter:Number) {
var numVar:Number = frameParameter;
trace(numVar);
}
// ----- BTN actions ----
btnClose.onRelease = function () {
_root.gotoAndPlay(1);
};
btnFWD.onRelease = function () {
frameFunction (25);
gotoAndPlay(61);
};
btnRWD.onRelease = function () {
frameFunction (55);
gotoAndPlay(61);
};
:::: on frame 91 :::
stop();
_root.gotoAndPlay(numVar);
View Replies !
View Related
How To Pass Parameter To OnKeyDown ?
my goal is to pass a parameter to an onKeyDown function.
when the user types inside an input text field, i want it to
update a dynamic text field, so that it shows the user what they
are typing.
the following code is what i am trying to do, though it does not work.
any ideas ???
Code:
function watchMeType(myInputTextField,myDynamicTextField){
Key.addListener(_root.myInputTextField);
_root.myInputTextField.onKeyDown = function(){
_root.myDynamicTextField.text = _root.myInputTextField.text;
}
}
View Replies !
View Related
How Can I Pass A Parameter To AttachMovie
here is my code:
infoClips(box1);
function infoClips(clipVal){
trace(clipVal)
mcMain.attachMovie(clipVal, "newBox1", 21, {_x:44, _y:94});
}
how can i pass the parameter : "box1" to the function "infoClips" and into the first value of the attachMovie object? because that value is expecting a string and not a value.
Anyway to maybe solve this by convertinga value into a string . how do i do this?
hellllppppp. been at this all day at work and the boss is expecting to see the script soon.
View Replies !
View Related
How Do You Pass Parameter To Urlrequest?
Im trying to build a mp3 player, so when the user clicks a button it loads the right track. How would I pass the right track to the urlrequest to load the right track? This plays the sound fine:
Code:
var request:URLRequest = new URLRequest("Audio/One.mp3");
_track1.load(request);
but this does not work:
Code:
var request:URLRequest = new URLRequest(request);
_track1.load("Audio/One.mp3");
I just dont want to have seperate urlrequests for each track that I want to load, or do I have to? Cant i just pass the mp3 to load to the urlrequest?
edit: sorry I just read my post and it doesnt make sense. my head is spinning trying to learn this stuff too fast.
Im just trying to have a button pass the track to be loaded to the urlrequest so it loads the right mp3.
View Replies !
View Related
Pass Class Name As Parameter
Is it possible to pass a class name as a parameter to a function?
We created a custom class for button and updated the Linkage to point to that class.
Example: ButtonRed -> scripts.Button and ButtonBlue -> scripts.Button
Is it possible to pass the names ButtonRed and ButtonBlue to a function? We want to have a button creator object that takes the name of the class name (ButtonRed or ButtonBlue) and the number of items to generate the correct number of buttons.
View Replies !
View Related
Pass MouseEvent As Parameter
I would like to pass a mouse event : MouseEvent.CLICK as a parameter.
example:
activateEvent(MouseEvent.Click,clickedEvent);
function activateEvent(event:MouseEvent,destination):void{
mc.addEventListener(event,destination,false,0,true );
};
View Replies !
View Related
Pass MouseEvent As Parameter
I would like to pass a mouse event : MouseEvent.CLICK as a parameter.
example:
ActionScript Code:
activateEvent(MouseEvent.Click,clickedEvent);
function activateEvent(event:MouseEvent,destination):void{[indent]
mc.addEventListener(event,destination,false,0,true);
};
[/indent]
Any Thoughts?
View Replies !
View Related
How Can I Pass A Button Value Or Parameter With Url
hi there i just start learning actionscript and i want some help in something.(1st)how can i pass a button value or parameter with url to be like this (index.html?name=anything&age=anything).(2nd)how can i select just one frame to execute an action on it in document content many layer.
thank you and i hope that i clarify my problems.
View Replies !
View Related
Array As Parameter -> Pass By Value?
Hey everyone
I'm trying to make a function that takes an array as parameter and modifies the array, without modifying the original array.
Code:
var originalArray:Array = new Array("Bird", "Cat", "Fish");
private funtion modify(a:Array)
{
a.push("Bear");
a.push("Eagle");
trace(a) // Bird, Cat, Fish, Bear, Eagle
trace(originalArray) // Bird, Cat, Fish
}
modify(originalArray);
But it seems like all arrays are passed by reference.. Is there no way to pass an array with objects as value?
View Replies !
View Related
Pass Object As Parameter
Hi!
We need to send some transition parameters through a localConnection... it could be passed as a string, xml or maybe an object... but it only works if we put the parameters "hard coded". We need something like the code below:
Code:
listeningLC.transition = function(pTranstionsParams:Object){ var tm:TransitionManager = new TransitionManager(mc_xyz); tm.startTransition({type:mx.transitions.Zoom, direction:0, duration:2, easing:mx.transitions.easing.None.easeNone, param1:empty, param2:empty}); }
The part {type:mx.transitions.Zoom, direction:0, duration:2, easing:mx.transitions.easing.None.easeNone, param1:empty, param2:empty}
should be passed as a parameter because it might be changed at runtime... but we have tried a lot of different things, but we didn't get through it...
Could any one give any clue?
Best Regards
View Replies !
View Related
How To Pass Parameter From Flash To Html
Hie everyone......
I have created a website in flash which has a shopping cart. When user clicks Add to cart button he is redirected to htm page. Here i need to pass the parameter from flash to htm. I am using Micromedia flash 8 ver.
the AS that i have used is:
on (release) {
_root.holder_mc.getURL("test.html?abc=123");
}
I have tried my best to explain things.......... please forgive me if there is any mistake
Thank U
View Replies !
View Related
How To Pass Parameter Into Event Handler?
hi,
e.g.
ActionScript Code:
addEventListener(MouseEvent.CLICK,showMeTheMoney);
function showMeTheMoney(e:MouseEvent):void
{
}
I used loop to create 500 sprites and each of them will addEventListener shown above.
I wish I can pass the different amount of money into the eventHandler showMeTheMoney so it can receive as argument.
any Idea?
View Replies !
View Related
How To Pass Parameter(s) To Event Handler?
hi,
Is is possobile to pass parameters to event handler? I want to let several event handlers share some common behaviours, like this:
ActionScript Code:
a_mc.onMouseMove = mcHandler;
a_mc.onMouseDown = mcHandler;
b_mc.onMouseMove = mcHandler;
b_mc.onMouseDown = mcHandler;
function mcHandler(param1, param2,...) {
if (is_mouseMove) {
// proceed mouse move specific code here...
}
if (is_mouseDown) {
// proceed mouse down specific code here...
}
/*
proceed some common tasks code here...
*/
}
or I have write different code for each event handler? I tried following syntax, but it doesn't work
ActionScript Code:
a_mc.onMouseMove = moveHandler;
a_mc.onMouseDown = downHandler;
b_mc.onMouseMove = moveHandler;
b_mc.onMouseDown = downHandler;
function moveHandler() {
/*
proceed mouse move specific code here...
*/
commonTask();
}
function downHandler() {
/*
proceed mouse down specific code here...
*/
commonTask();
}
function commonTask() {
/*
proceed some common tasks code here...
*/
}
please help, thanks!
View Replies !
View Related
HowTo Pass Object As Parameter AS3?
I'm getting the impression that passing non-static objects isn't allowed in AS3. I never had a problem with this in AS2. Am I correct in this understanding?
If so, do you know what is considered best practice in regards to passing non-static objects as parameters? Is this not a good practice? Thanks!
View Replies !
View Related
Isn't Its Possible To Pass Parameter With Timer Events
helo every one,
i have a array which i need to plot on the screen. the plotting should have some delay in between so that we can see the points being plotted. i tried using timer class but when the event occurs my loop index has always reached last element. any help...
heres the code i used
Attach Code
for(var i =1;i<myArray.length;i++)
{
var myTimer:Timer = new Timer(2000,1);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
}
function timeHandler(event:TimerEvent)
{
thisObj.polySprite.graphics.lineTo(myArray[0].x,myArray[0].y); //myArray elements have x and y property and no problem with it
}
}
View Replies !
View Related
Isn't Its Possible To Pass Parameter With Timer Events
helo every one,
i have a array which i need to plot on the screen. the plotting should have some delay in between so that we can see the points being plotted. i tried using timer class but when the event occurs my loop index has always reached last element. any help...
heres the code i used
Attach Code
for(var i =1;i<myArray.length;i++)
{
var myTimer:Timer = new Timer(2000,1);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
}
function timeHandler(event:TimerEvent)
{
thisObj.polySprite.graphics.lineTo(myArray[0].x,myArray[0].y); //myArray elements have x and y property and no problem with it
}
}
View Replies !
View Related
Pass Variable To Netstream.play URL Parameter
Hi,
I'm currently launching FLVs into a video component using netconnection and netstream. To change the current video, I'm using buttons that update the netsream url via 'ns.play("url")', my question is this: can I pass a variable to the URL parameter of 'ns.play'?
Basically what I'm attempting to do is to specify the URL for each of my FLVs via the instance name of the buttons calling them, rather than attaching code to each button as there will eventually be loads of them.
i.e. say I have three buttons, instance named 'vid1, vid2 and vid3' respectively; and I have 3 videos named 1.flv, 2.flv, 3.flv
I would like to make flash pass the number on the end of the instance name of each button to the URL parameter of ns.play in order that I don't have to attach individual code to loads of buttons.
I have been attempting to use the following code:
//------- SETUP NETSTREAM/CONTROLLER FUNCTIONS/LOADING BAR/SCRUB/TXT -----------
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
display.attachVideo(stream_ns);
stream_ns.play("http://www.dedicatedmicros.com/ukftp/FLVHUB/testflv.flv");
//------- DYNAMIC FLV/BUTTON CODE --------------------
//use a for loop to reduce repetition of the code
for(i=1;i<6;i++){
theButton=_root.btnmenu["vid"+i];
//this variable stores what number button it is
theButton.thisNum=i;
theButton.onEnterFrame=function() {
//on release
_root.btnmenu["vid"+this.thisNum].onRelease = function() {
//set stream
stream_ns.play(["http://www.dedicatedmicros.com/ukftp/FLVHUB/"+this.thisNum+".flv"]);
}
}
}
This is, however, not passing the variable to the URL parameter of .play
Any ideas how this can be achieved or even a better way around it?
For your reference I have uploaded both a test SWF and FLA to the following:
http://www.dedicatedmicros.com/ukftp...B/flvtest.html
http://www.dedicatedmicros.com/ukftp/FLVHUB/flvtest.fla
Any tips/advice are much appreciated,
Thanks,
DigiPencil
View Replies !
View Related
How To Pass Parameter To AS2 Movie And Still Use Browser's Cache?
Hello,
I am loading an AS2 movie from AS3, and would like to pass a parameter to it. The value of the parameter will be different each time.
The loaded movie is quite big, and I need it to be loaded from the browser's cache.
However, everything I have tried appends the parameter as a query string, which is a problem because then it won't load the movie from the browser's cache, since the browser recognizes it as a "different" file to load.
Example:
PHP Code:
var urlVars:URLVariables = new URLVariables();
urlVars.myvar = "randomvalue";
var urlReq:URLRequest = new URLRequest("child.swf");
urlReq.data = urlVars;
var ldr:Loader = new Loader();
ldr.load(urlReq, addedDefinitions);
The problem is, this will make a request that looks like:
PHP Code:
child.swf?myvar=randomvalue
Since myvar is assigned a different random value for each call, it doesn't end up loading child.swf from the browser's cache.
Is there any way to load the file as just "child.swf", and pass myvar as a FlashVar (or whatever the equivalent is in AS3)? Ideally, the variable would be available to the child movie as _root.myvar.
I can do this from the HTML webpage (using FlashVars), but I can't seem to do it in AS3 directly.
Thank you!
p.s. I tried using: urlReq.method = URLRequestMethod.POST;
But that seems to cause it not to use the browser's cache either.
View Replies !
View Related
How To Pass Parameter To AS2 Movie And Still Use Browser's Cache?
Hello,
I am loading an AS2 movie from AS3, and would like to pass a parameter to it. The value of the parameter will be different each time.
The loaded movie is quite big, and I need it to be loaded from the browser's cache.
However, everything I have tried appends the parameter as a query string, which is a problem because then it won't load the movie from the browser's cache, since the browser recognizes it as a "different" file to load.
Example:
PHP Code:
var urlVars:URLVariables = new URLVariables();
urlVars.myvar = "randomvalue";
var urlReq:URLRequest = new URLRequest("child.swf");
urlReq.data = urlVars;
var ldr:Loader = new Loader();
ldr.load(urlReq, addedDefinitions);
The problem is, this will make a request that looks like:
PHP Code:
child.swf?myvar=randomvalue
Since myvar is assigned a different random value for each call, it doesn't end up loading child.swf from the browser's cache.
Is there any way to load the file as just "child.swf", and pass myvar as a FlashVar (or whatever the equivalent is in AS3)? Ideally, the variable would be available to the child movie as _root.myvar.
I can do this from the HTML webpage (using FlashVars), but I can't seem to do it in AS3 directly.
Thank you!
p.s. I tried using: urlReq.method = URLRequestMethod.POST;
But that seems to cause it not to use the browser's cache either.
View Replies !
View Related
Need To Pass An _instance_ Of A Class To The Second Parameter Of SetStyle()
Hello everyone,
This is my first post in this forum and I'm still fairly new to AS3
In most examples I can find with using the style manager, an instance of a class is given for the second parameter. Here's from Adobe's own documentation:
Code:
private var formatForInstance:TextFormat;
[...]
formatForInstance = new TextFormat();
[...]
uiComponent.setStyle("textFormat",formatForInstance);
(taken from the StyleManager documentation)
However, it would appear to be a different situation for DataGridCollumn, et al (?) Instead, the name of the class itself (rather than an instance) is passed for the second parameter. From the documentation for CellRenderer:
Code:
myTileList.setStyle('cellRenderer', MyRenderer);
[...]
class MyRenderer extends CellRenderer
Why is this? I'm sure it's obvious why, but it isn't to me. My issue is that I made a custom class based on CellRenderer (and implementing ICellRenderer) and want to be able to send custom events to any instance that is created automatically (?) when I create rows. If an innumerable amount are created, it may be more efficient to have it somehow access the class it's the style for, but I don't know how to do that either and am not sure I would like that solution... If only one is created/needed, then I'd really like to just be able to access that instance, just to set up the event listener.
Thanks in advance if anyone has any ideas.
View Replies !
View Related
How To Pass Parameter To AS2 Movie And Still Use Browser's Cache?
Hello,
I am loading an AS2 movie from AS3, and would like to pass a parameter to it. The value of the parameter will be different each time.
The loaded movie is quite big, and I need it to be loaded from the browser's cache.
However, everything I have tried appends the parameter as a query string, which is a problem because then it won't load the movie from the browser's cache, since the browser recognizes it as a "different" file to load.
Example:
PHP Code:
var urlVars:URLVariables = new URLVariables();urlVars.myvar = "randomvalue";var urlReq:URLRequest = new URLRequest("child.swf");urlReq.data = urlVars;var ldr:Loader = new Loader();ldr.load(urlReq, addedDefinitions);
The problem is, this will make a request that looks like:
PHP Code:
child.swf?myvar=randomvalue
Since myvar is assigned a different random value for each call, it doesn't end up loading child.swf from the browser's cache.
Is there any way to load the file as just "child.swf", and pass myvar as a FlashVar (or whatever the equivalent is in AS3)? Ideally, the variable would be available to the child movie as _root.myvar.
I can do this from the HTML webpage (using FlashVars), but I can't seem to do it in AS3 directly.
Thank you!
p.s. I tried using: urlReq.method = URLRequestMethod.POST;
But that seems to cause it not to use the browser's cache either.
View Replies !
View Related
How Can I Pass A Parameter From A Class To An Object Created In The .fla File?
Hi,
I am new here in this forum.
I have this class, which is working fine, but I would like to pass a parameter to the objects in my .fla file and I have no idea how.
This is a class that can be apply to any object to fade it, the problem is that the alpha percentage is fixed, and I would like to have different percentage on each object.
How could I accomplish this task?
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gs.TweenLite;
import fl.motion.easing.*;
public class TestClass {
private var _clip:MovieClip;
public function TestClass(clip:MovieClip) {
_clip = clip;
_clip.addEventListener(MouseEvent.MOUSE_OVER, fadeIn);
_clip.addEventListener(MouseEvent.MOUSE_OUT, fadeOut);
}
function fadeIn(event:MouseEvent) {
TweenLite.to(_clip,1,{alpha:.5});
}
function fadeOut(event:MouseEvent) {
TweenLite.to(_clip,1,{alpha:1});
}
}
}
// This is the code I’m using in my fla file (objects in my fla file)
ActionScript Code:
var testing:TestClass= new TestClass(myMc);
var testing2:TestClass= new TestClass(myMc2);
var testing3:TestClass= new TestClass(myMc3);
Thank you to all in advance,
fs_tigre
View Replies !
View Related
How Can I Pass A Parameter From A Class To An Object Created In The .fla File?
Hi,
I have this class, which is working fine, but I would like to pass a parameter to the objects in my .fla file and I have no idea how.
This is a class that can be apply to any object to fade it, the problem is that the alpha percentage is fixed, and I would like to have different percentage on each object.
How could I accomplish this task?
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gs.TweenLite;
import fl.motion.easing.*;
public class TestClass {
private var _clip:MovieClip;
public function TestClass(clip:MovieClip) {
_clip = clip;
_clip.addEventListener(MouseEvent.MOUSE_OVER, fadeIn);
_clip.addEventListener(MouseEvent.MOUSE_OUT, fadeOut);
}
function fadeIn(event:MouseEvent) {
TweenLite.to(_clip,1,{alpha:.5});
}
function fadeOut(event:MouseEvent) {
TweenLite.to(_clip,1,{alpha:1});
}
}
}
// This is the code I’m using in my fla file (objects in my fla file)
var testing:TestClass= new TestClass(myMc);
var testing2:TestClass= new TestClass(myMc2);
var testing3:TestClass= new TestClass(myMc3);
Thank you to all in advance,
fs_tigre
View Replies !
View Related
A Simple Tooltip Function That Can Be Easily Changed
After messing with virtually every componentized tooltip under the sun and discovering that NONE of them can redraw a new message if the tooltip data changes, I decided to throw together something very simple that can be called from anywhere and always works. I'm calling it the "bTooltip" because my name is Brett and I'm sick of tooltips that don't work right and come with zero documentation. I hope this simple function saves someone a weekend, of trying to programatically change one of those crappy tooltip components from the Macromedia/Adobe Exchange. This one isn't feature-rich, but it should be easy for anyone to tweak if they wan't other features. Also, if someone wants to fix this to show the correct fonts, feel free.
Code:
// Simply put this function on your _root timeline and then call it from
// anywhere by using _root.bTooltip("message text", true);
// I just attach it to the onRollOver event of buttons and movieclips.
// The first parameter is the message to display. The second parameter
// can either be a width to display a fixed width tooltip with wordwrapping,
// or you can pass a boolean "true" or string "autosize" to have it size
// itself to the raw string. If you use autosize option you have to put
// your own linebreaks in the string using "
" characters.
// To hide/destroy a tooltip simply call the function with false like this:
// _root.bTooltip(false,false);
// Just attach this to the onRollOut event of a button or movieclip
function bTooltip(message_string,the_width){
var autosizeit = false;
if(!_global.tooltip_depth){
_global.tooltip_depth = _root.getNextHighestDepth();
}
//unload the tooltip if we called the function with "false"
//let's be redundant since flash is a memory leaking whore
if(message_string == false){
_root.tooltip.text_field.removeTextField();
_root.tooltip.unloadMovie();
delete _root.tooltip;
}
//create the tooltip
_root.createEmptyMovieClip("tooltip",_global.tooltip_depth);
_root.tooltip._visible = false;
if(message_string == "" || message_string == undefined){
message_string = "You did not set your message properly. This text is displaying for diagnistic purposes so that you can see if the word wrapping and other features are working right";
}
if(the_width == "autosize" || the_width == true){
the_width = 20;
autosizeit = true;
}
_root.tooltip.createTextField("text_field",_root.tooltip.getNextHighestDepth(),0,0,the_width,20);
_root.tooltip.text_field.font = "_sans";
if(autosizeit == true){
_root.tooltip.text_field.autoSize = "left";
}else{
_root.tooltip.text_field.autoSize = "left";
}
_root.tooltip.text_field.type = "dynamic";
_root.tooltip.text_field.border = false;
_root.tooltip.text_field.multiline = true;
_root.tooltip.text_field.html = true;
_root.tooltip.text_field.embedFonts = false;
_root.tooltip.text_field.selectable = false;
if(autosizeit == true){
_root.tooltip.text_field.wordWrap = false;
}else{
_root.tooltip.text_field.wordWrap = true;
}
_root.tooltip.text_field.mouseWheelEnabled = false;
//_root.tooltip.text_field.setNewTextFormat(_root.tooltip.text_field);
//text_field.condenseWhite = false;
//text_field.styleSheet = undefined;
_root.tooltip.text_field.text = message_string;
//now draw the background and outline
_root.tooltip.beginFill(0xFFFF99, 80);
_root.tooltip.lineStyle(1, 0x000000, 80);
_root.tooltip.moveTo(0, 0);
_root.tooltip.lineTo(_root.tooltip.text_field._width, 0);
_root.tooltip.lineTo(_root.tooltip.text_field._width, _root.tooltip.text_field._height);
_root.tooltip.lineTo(0, _root.tooltip.text_field._height);
_root.tooltip.lineTo(0,0);
_root.tooltip.endFill();
_root.tooltip.onEnterFrame = function(){
if(this._visible == false){
this._visible = true;
}
this._x = _xmouse + 15;
this._y = _ymouse + 5;
}
}
Note: Originally I used a "with(_root.tooltip)" statement to set all the tooltip and text_field properties, but discovered that this screwed up the scope of the variables I was passing into the function to control the sizing, so I switched it back to the long way.
View Replies !
View Related
Using < And > As A Parameter In Function
I was wondering if there is a way to us the greater than and less than signs as a parameter in a function?
What I would like...
Code:
myfunction = function(equality){
if ( varX equality varY){
Do this;
}
}
and calling it...
Code:
button1.onMouseOver = function(){
myfunction(>);
}
View Replies !
View Related
Parameter Of Function
Hi guys!!!!
I got a function like this:
function state (choice) {
_root.buttons.choice_mc.choice_selected._visible = true;
};
So, as you already have guessed, the "choice" in the setence inside the function is the parameter that enters the function. The problem is this doesn't work..i guess i have to "say" that the choise in the _root.bla bla bla is the var that enters the function!
How to do that?
Thanks a million!!!
View Replies !
View Related
Using Function As A Parameter
I cannot figure out why this code does not work
PHP Code:
class MyClass extends MovieClip {
public function trace_1():Void {
trace(1);
}
public function alert_1():Void {
getURL("javascript:alert('1')");
}
public function do_something(f:Function):Void {
f();
}
// Constructor
public function MyClass() {
trace_1(); //prints 1
alert_1(); //alerts 1
do_something(trace_1); //prints 1, really great
do_something(alert_1); //DOES NOTHING!!!!! WHY?????
}
}
View Replies !
View Related
Function Parameter Problemo
Hello,
I am having problems getting a function to target a movie clip. The mc has an instance name mcDDMTV.
There are about six mcs but I just want to get it working for one for now. The mc instance names are part of an array:
menusys = new Array ();
menusys[0] = "";
menusys[1] = mcDDMTV;
menusys[2] = mcDDMFA;
menusys[3] = mcDDMI;
the function is as follows:
function menu (myname) {
for (i=1; i<4; i++) {
if (menusys[i]==myname) {
"myname".gotoAndPlay(2);
}
}
}
}
(there is a pair of square brackets with an i in the middle after menusys in the menusys==myname line but it wont appear on this post for some reason)
The parameter is the instance name and the call for that function is on a button in the movieclip on the main timeline:
on (press) {
_parent.menu(mcDDMTV);
}
It just wont affect the mc. Obviously, if i type in the mc instance name before the gotoAndPlay(2); it works but I dont want to do that. Any help or ideas would be 'kin beauty. Thankyou
Sam
[Edited by gridzone on 07-25-2001 at 08:34 AM]
View Replies !
View Related
Return As Function Parameter
how to return true/false (or anything at all), when the parameter is a function?
code:
function f(g, arg) {
g.call(this, arg);
}
//simple working example
function move(mc) {
mc.onEnterFrame = function() {
this._x += 5;
};
}
f(move, ball);
//not working
function returnV(v) {
return v;
}
trace(f(returnV, true));//outputs undefined
function returnV2() {
return true;
}
trace(f(returnV2));//outputs undefined
View Replies !
View Related
Problem Is Parameter In Function
i have a problem what is the parameter in function's type?
you see my two examples that the result is different
in the example1 the parameter can be changed in the test function
but in the example2 cannt.
why?
Code:
//example 1
var myMC=_root.createEmptyMovieClip("mc", 1);
function test(myMC) {
trace("test.myMC before remove is: "+myMC);
myMC.removeMovieClip();
trace("test.myMC after remove is: "+myMC);
}
test(myMC);
trace("_root.myMC before remove is: "+myMC);
myMC.removeMovieClip();
trace("_root.myMC after remove is: "+myMC);
Code:
//example 2
var myNum=0;
function test(myNum) {
trace("test.myNum before add is: "+myNum);
myNum++;
trace("test.myNum after add is: "+myNum);
}
test(myNum);
trace("_root.myNum before add is: "+myNum);
myNum++;
trace("_root.myNum after add is: "+myNum);
View Replies !
View Related
|