Action script 3 and adding code to buttons
When I open a new doc and selct action script 3 it won't
allow me to insert code by selcting the button on the stage. It
does if I select action script 2. All my old pages update ok but if
I make new buttons it wont take the code. CAn someone tell me what
is going on???
Thanks a lot
If your in a bind at the moment, I would suggest not
attempting to learn AS3. The system is very different, good, but
different, the syntax structure is much more strict and most things
have been revised to use a listener/broadcaster (or event
dispatcher) model, as well as most coding being class oriented,
additionally the graphic display structure is quite different.
Now did you change your publish settings back to AS2? If so,
you should still be able to apply the above code to a button
instance. However, as Dave stated, even in AS2 the code is best
used from the timeline, to do so with the code above (which the on
handler above is meant for Object attachment) you need to write it
like this:
my_btn.onPress = function() {
_root.loadMovie("graphic_arts/graphic_arts.swf");
I would also consider using a MovieClipLoader and the
loadClip method forloading swf files, as it gives you more control
over the load targeting, progress reporting, and event
notifications.
All this said, to use a button and load a file in AS3, you
need to add an event listener to the button instance and construct
a responding function to the event, in this case the loading of a
swf file. Additionally, in AS3 the MovieClipLoader class, as well
as the loadMovie methods have been replaced by the Loader classes
and must be used to load swf files. So construct a button in AS3
you must write something like the following:
Similar Messages
-
Calling a VB Script and Matlab code from LabVIEW GUI.
Hi,
Can anyone help me out in Calling a VB Script and Matlab code from LabVIEW GUI? GUI will be developed in Labview and currently we have some scripts written in VB and Matlab and we need to incorporate the same through LabVIEW. Can anyone let me know how this can be implemented?
Regards,
SharmashFor VBScript you can call the Windows Scripting Host application using the System Exec function, or you can use IScriptControl, which is an ActiveX control. Be aware that with the IScriptControl there's a small bug. You can read more about it in this post.
For Matlab, there's a Matlab node that you can use. You can either copy and past your Matlab script in the node, or just write a function call statement. The node simply calls Matlab. Or, you can do as suggested and use the MathScript node, which is basically an alternative to Matlab. The MatchScript node doesn't support everything that Matlab does, so you will need to check it against your script.
Or, you can do as suggested, and rewrite it all in LabVIEW, unless you can't because these scripts are used by other applications. -
Error in action script and button
I have a page that i have designed for practice. i have three
buttons on each page and have been tring to get them to link to the
proper page/frame. For instance the button for ABOUT US should link
to the second page/frame. The code i am using is as follows.
on (release) {gotoAndStop(2);
This should have it go to page/frame 2 and stop but when i
test it it gives me this error.
Scene 1, Layer 'about', Frame 1, ... 1087: Syntax error:
extra characters fou... on (release) {gotoAndStop(2);
I am using action script 1.0 & 2.0. I am not sure what to
do.The way that this function is written, on (release), it
should be
directly attached to a button or movieClip instance. However,
the
gotoAndStop(2) command is telling the button or clip to go to
frame 2,
not the main timeline. If you change that line to
_parent.gotoAndStop(2), you'll get the playback head on the
main
timeline to move, not the playback head in that button or
clip.
A far better method is to assign instance names to each
button or
movieClip that you want to react to actionscript. Then you
can write the
function(s) for those instance names. You would write the
actionscript
to a frame instead of directly on the button or clip. This
makes the
actionscript much easier to find when you need to edit.
So, for instance, you could then write a set of functions to
move the
playback head. Something like this:
// we'll assume that the buttons are named button1, button2,
button3
button1.onRelease = function() {
gotoAndStop(X);
button2.onRelease = function() {
gotoAndStop(Y);
button3.onRelease = function() {
gotoAndStop(Z);
// where X,Y and Z are the frame numbers that you want to
move to
// you don't need an explicit reference for the timeline for
the
playback head to use here. The code and the objects are all
on the same
timeline. -
Action Script and button Behavior
Imported a bmp as png, made it into a movie clip. Setup the
AS to call for page 4. It works great. I would now like to have a
text box come up on the rollover. I tried to nest the mc into a
button. I can make the text box work but the script won’t
work when I click.
Could you refer me to a resource that would explain the
relationship between the two. Or is there another way to do this.
So the text box says “Click here for more Info”.
Can’t click to execute Action Script, I think it is not
addressable because it’s nested in the button.
If I reverse the nesting then the text box in the over frame
won’t execute.Mjddoyle wrote:
> Imported a bmp as png, made it into a movie clip. Setup
the AS to call for page
> 4. It works great. I would now like to have a text box
come up on the rollover.
> I tried to nest the mc into a button. I can make the
text box work but the
> script won?t work when I click.
> Could you refer me to a resource that would explain the
relationship between
> the two. Or is there another way to do this.
> So the text box says ?Click here for more Info?. Can?t
click to execute Action
> Script, I think it is not addressable because it?s
nested in the button.
> If I reverse the nesting then the text box in the over
frame won?t execute.
Sorry, a bit chaotic and i can't really get your arrangement.
Please upload what you have so far, we will go from there.
There is so many ways to achieve the same thing in flash that
there
is no point going into it, could turn up suggested solution
totally
does not suit your project. Need to see what you have so far.
Upload to your server and provide URL for us to check.
Best Regards
Urami
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
Can FC put action script in a 'code behind'.
Once of the practices I do in FB3 is to move all my action script into 'code behind' files instead of having all the code in the mxml files. Does FC have the option to do that (as part of the gen process) and if not, does anyone else who 'codes' instead of 'designs' feel that is a benefit? I know I'd prefer it to be in a 'separate' as3 file. Also, if I DO move the code into code behinds (I've not tried it yet), does FC have any issues reading the code behind? I'll be trying that on a 'simple' project to be sure but figured I'd ask just in case anyone else wants to know...
The two references cited helped answer questions about Adobe's overall philosophy and approach that came up as I worked a simple example down the design/development stack of tools from Illustrator (AI) to Catalyst (FC) to Flash Builder 4 (FB).
Other questions that arose were:
Each application (AI, FC, FB) contains tools for design with some degree of overlap.
Will FC eventually include from AI (or Photoshop, InDesign, etc.) and the FB design view all functionality needed for interactive storyboarding and skin generation?
Is it the intent for FC to become the designer's tool and FB the developer's tool, at least for application design?
The diagram in the Gumbo skinning spec shows that base components and their subclasses are typically implemented in AS and skins in MXML and recommends this as the preferred design pattern. Yet when I converted one of my groups (essentially a form) to a customized component, and exported the project into FB, I noticed that FC had generated a single mxml file (CustomComponent1 ...) and not a pair of files (an X.as file for the base component and an X.mxml file for the skins).
For several reasons, wouldn't you want to generate separate files as depicted in the Gumbo diagram as a starting point for code customization?
How does one develop custom components in FB (or using AI+FC+FB) and package them as a library so that they can be dropped into FC and used in the way that the current set of 5 components (button, hscrollbar, vscrollbar, text input and data list) are used?
How will I integrate my hand-coded dynamic components for data visualization alongside more generic and static app components on an RIA page?
How would I use AI+FC to design liquid layouts where children at each level often utilize constraints (i.e. top, bottom, left, right) between parent and child?
For agile methodologies, how will refactoring the interaction or software design work in this new world where interaction designers are trying to maintain full control over appearance and interactive behavior?
Finally, I would like to know what tools and steps Ely used to develop the component shown in the video. It would be instructive to turn that into a tutorial that we could walk through, step by step, in slow motion
While I understand the arguments for separation of design and development as a workflow methodology, those of us with development and HCI/visualization backgrounds building research prototypes would like to see integration of the design and development tools (from the perspective of the workflow, not the architecture and code).
As Jordan said, the direction you are heading is inspiring. Keep up the good work. -
Problem in merging java script and java code
hi,
i want to merge java and javascript code but it is giving some surprising results.
this is my code:
<script language = "javascript">
<%
String query_result= "1";
String buttontype="";
buttontype=(String)session.getAttribute("buttontype");
query_result = (String) session.getAttribute("query_result");
out.println(query_result);
if(buttontype!=null&&(buttontype.equals("submit")))
out.println(buttontype);
%>
alert(<%=ka%>)
</script>
<%
%>
now if i'll move "<script language = "javascript">" to:
<%
String query_result= "1";
String buttontype="";
buttontype=(String)session.getAttribute("buttontype");
query_result = (String) session.getAttribute("query_result");
out.println(query_result);*/
if(buttontype!=null&&(buttontype.equals("submit")))
out.println(buttontype);
%>
<script language = "javascript">
alert(<%=query_result%>)
</script>
<%
%>
then it prints correctly and gives alert "1" but if i'll change query_result="manish" then it is not giving alert also
i don't know wht is happening
plz help me out
manishhi pgeuen,
Thanx for ur reply
now its working i have changed my jsp exp. tag to
alert("\"<%=ka%>\"")
and it is displaying correctly.
and if i'll give the scripting tags in "if block"then it will work but till now i didn't get why i was not getting any output when the scripting tags covers the whole jsp code. i think we can mix java script and jsp in any way.
well thanx a lot.
manish -
Action script and default values
While importing data through action script, even if the property value present in Action script is same as default value defined at the property level , DRM marks that property value as Overridden in the hierarchy.
Is there any possible way to avoid this?Default value is set when no value is entered for the property. As soon as you enter a value for the property thru action script or manually, its overridden even though the value is the same which was set at the property level
Right click on the property and do a remove value then the icon should be set to default again.
If you want to restore multiple properties back to default, then use remove all below at the rollup level -
Dear Flash Experts,
I know we can place codes within "Actions", but where do we
go to view the actual codes? You know behind
the scene. Is there a way to do so. I can not believe Adobe
would design a software program such as "Flash" and
not allow the Designer to view the codes that have been
placed within the website.
Can anyone help?
Thanks!in flash help docs, open Actionscript Language
Reference-->Actionscript Classes-->XML.. then read -
I am getting this message in the output tab for buttons that I am trying to create. Here's the code:
import flash.events.MouseEvent;
stop();
function goHome(myEvent:MouseEvent):void {
gotoAndStop("home");
SoundMixer.stopAll();
function goAbout(myEvent:MouseEvent):void {
gotoAndStop("about");
SoundMixer.stopAll();
function goBusiness(myEvent:MouseEvent):void {
gotoAndStop("business");
SoundMixer.stopAll();
function goContact(myEvent:MouseEvent):void {
gotoAndStop("contact");
SoundMixer.stopAll();
function goArchives(myEvent:MouseEvent):void {
gotoAndStop("archives");
SoundMixer.stopAll();
function goBioTech(myEvent:MouseEvent):void {
gotoAndStop("bioTech");
SoundMixer.stopAll();
function goRealEstate(myEvent:MouseEvent):void {
gotoAndStop("realEstate");
SoundMixer.stopAll();
function goTechnology(myEvent:MouseEvent):void {
gotoAndStop("technology");
SoundMixer.stopAll();
function goEnergy(myEvent:MouseEvent):void {
gotoAndStop("energy");
SoundMixer.stopAll();
home_btn.addEventListener(MouseEvent.CLICK, goHome);
about_btn.addEventListener(MouseEvent.CLICK, goAbout);
business_btn.addEventListener(MouseEvent.CLICK, goBusiness);
contact_btn.addEventListener(MouseEvent.CLICK, goContact);
archives_btn.addEventListener(MouseEvent.CLICK, goArchives);
bioTech_btn.addEventListener(MouseEvent.CLICK, goBioTech);
realEstate_btn.addEventListener(MouseEvent.CLICK, goRealEstate);
technology_btn.addEventListener(MouseEvent.CLICK, goTechnology);
energy_btn.addEventListener(MouseEvent.CLICK, goEnergy);
I ran the debugger and got this:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at peakInsights_fla::MainTimeline/frame1()[peakInsights_fla.MainTimeline::frame1:48]
I guess it's telling me there's a problem with line 48 but what?
The home, about, business, contact, and archives button works. On the business page there are the remaining buttons biotech, technology, real estate, and energy. when i test it; i get the finger but the buttons don't work. this is my first flash site so I'am new, new.I followed the steps and read some of your comments on the same top topic in another thread. When I put it on the first frame it was okay but the next button on that page had the same problem. So what I am guessing is that I have to either create a document class or put the actions where the buttons are. Am I understanding that correctly? In the other thread in which you helped someone else; there was so comments about document class. I found a tutorial on it and the way I understand it is that it you can put you actions in an external document. But you have to include in the event listener the frame in which you want that action to happen.
Thaks for your help. And patience. -
SCCM 2012 application run Powershell script and return codes
Hi,
I created an new application (imported as MSI) in SCCM 2012R2. After import I changed the deployment type installation program to run a Powershell script: powershell.exe -ExecutionPolicy Unrestricted -File "Install FactSet 2013 5I.ps1
My goal is to close some processes before installing the MSI. This works. But on a failure the application program also return code 0 (AppEnforce.log). Is it possible to pass the MSI return codes to SCCM.
Maybe anyone had the same or idea's to solve this? Thanks in advance.
Regards,
Peter
Powershell script code:
$ExitCode=0
Function
Stop-RunningApplication{
Param(
[parameter(Mandatory
=$true)]
[string]$ProcessName#
Specify process names separated by commas
# Split multiple processes on a comma and join with the regex operator '|' to perform "or" match against
multiple applications
$processName=$processName-split(",")
-join("|")
$process=Get-Process|Where{
$_.ProcessName
-match$processName}
|Stop-Process-Force
#Stop running processes
Stop-RunningApplication
-ProcessName"excel,outlook,fdsw32,marquee,POWERPNT,WINWORD"
#Install FactSet 2013 5I
$ExitCode
=(Start-Process".\FactSet_Setup_2013_5I_x644.msi"'/qn
FACTSET_CLOSE_PROCESSES=1 /l*v C:\Temp\InstFac20135I.log'-Wait-Passthru).ExitCode
Environment]::Exit($ExitCode)
Peter vd BoschIt's really hard to tell from the code above because of the way it's listed, but are sure that even executes? I see at least one stray curly brace and a stray square bracket.
For the Start-Process cmdlet, have you tried without the -passthru parameter?
Also, using the actual parameters will make the code much more readable instead of relying on position.
Jason | http://blog.configmgrftw.com | @jasonsandys -
Action script error on a button
I have added following code on a button, btn_lab5, but I get
an error msg ,"Must appear within on handler". Thanks in advance!!!
btn_lab5.onRelease=function(){
gotoAndStop("intro", 1);
Thanks in advance!!!No, I don't have button within a button. But, Thanks for your
input.
Fortunately, I have found the solution by changing few things
around. Here is what I was trying to do..
1. Four buttons were placed on the same time line 15 frames
apart.
2. Added action script at each button and also tried adding
seperate layer for action script but when I ran my movie same
script played for every button.
Finally, got frustrated and placed all the buttons at the
same point in timeline and added action script by adding another
layer.Visually I am not getting the desired result with buttons but
code is working. I would really love to have buttons appear
gradually on the screen. Let me know if any one of has any thoughts
to share....
Thanks a lot!!!! -
Hi.
I am using NetConnection and NetStream to play back flv in Flash Pro CS5.5, and trying to add cue point to trigger events using Action Script, and to automatically rewind to the start at the end. There is no problem to trigger events via AS when the cue points are embedded, but i am unable to add cue points using AS.
When i use an FLVPlayback component, there is no problem to add cue points (http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d1 18a9c65586-7feb.html) and to loop the playback using autoRewind (and fl.video.VideoEvent.AUTO_REWOUND which i got from Nafem at http://forums.adobe.com/thread/857036).
However, i am failing to use this same code w/a netConnection and netStream, and would appreciate any help.
thanks.Hello,
Well, I've got some help from another helpful fellow at macscripter.net and I have a working script - albeit a bit more specific (ie, hardcoded extensions to look for) and a different approach.
Here's the script:
on adding folder items to thisFolder after receiving addedItems
repeat with movieFile in addedItems
set {Nm, Ex} to getName_andExtension(movieFile)
set movieFilePath to (thisFolder as text) & Nm & ".avi"
set subtitleFile to (thisFolder as text) & Nm & ".srt"
if Ex is ".srt" then
try
tell application "iFlicks"
import (movieFilePath as alias) with gui
end tell
end try
else if Ex is ".avi" then
if my FinderItemExists(subtitleFile) then
try
tell application "iFlicks"
import (movieFilePath as alias) with gui
end tell
end try
end if
end if
end repeat
end adding folder items to
on getName_andExtension(F)
set F to F as Unicode text
set {name:Nm, name extension:Ex} to info for file F without size
if Ex is missing value then set Ex to ""
if Ex is not "" then
set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
set Ex to "." & Ex
end if
return {Nm, Ex}
end getName_andExtension
on FinderItemExists(thePath)
try
set thePath to thePath as alias
on error
return false
end try
return true
end FinderItemExists -
Difference in using the same component made in mxml or action-script
Hi,
I made a sample project to show a kind of bug in the SuperTabNavigator component of FlexLib
In this sample you can see that using the same component (made in both mxml or action-script) can make a difference
I'm just wondering why ?
Thanks
Here is what i've posted :
What steps will reproduce the problem?
1. Create a button to dynamically add new tab with icon on a SuperTabNavigator
2. Click on this button to add new tabs
What is the expected output?
- The expected output is tabs added without abnormal behavior
What do you see instead?
- Every time a new tab is created the one who had the focus has its content
(icon + label) moving from the top-left of the tab to its original position
Please provide any additional information below.
Configuration:
- Flex Builder 3 in Eclipse
- FlexLib 2.3
Sample:
(see attached file)
There is two type of tab, one in action-script and one in mxml
They both are equal
- Adding a new action-script tab to SuperTabNavigator works fine
- Adding the same tab but an mxml one doesn't
- Adding a new action-script or mxml tab to TabNavigator works fine
-> meanings that the issue comes with SuperTabNavigator
- Adding a new mxml tab to both SuperTabNavigator and TabNavigator at the
same time makes TabNavigator to get the same bad behavior
Remarks:
- Tried everything but i'm really stuck
- Weirdly, removing the PopUpButton correct the issue
- In the same way if you keep adding action-script tab it automatically scroll to the
last tab. And if you do the same with mxml tab then it add the tab at the end and
scroll to the first one.
=> what could be the difference between using action-script or mxml object ?Here is one possible solution:
You can use the ExternalInterface (
http://livedocs.macromedia.com/flex/2/langref/flash/external/ExternalInterface.html)
class to communicate with JavaScript. JavaScript can then popup the
media player very easily like this:
http://www.webreference.com/programming/javascript/jf/column5/index.html
The documentation on the ExternalInterface class has a nice
example (in the bottom of the page) on how to communicate with
JavaScript in a browser. Hope this helps,
-george -
Action Script to restart movie with mouse
I added code using Script Assist in Flash CS4 to pause the
movie at the end frame until the user clicks on the mouse to
restart it. Seemed so easy but I have tried everything I can think
of and nothing works. I actually did this in an earlier version of
Action Script and now I am lost. The code I used is attached. Any
help is greatly appreciated!
RichardInstalled and working. Thanks for the code!
-
Editing a record and adding cffile, please help
Hello;
I am writting an editor page for a web site. I am trying to
add cffile to the edit function. This page acts as 2 ways of
editing the DB records, it can add a new one, and it can edit an
exisitng one.
What I am trying to do is this:
1. When you add a record, you can upload an image and add all
the content in the other feilds, click the ok button and it will
upload the file, and add the file name to the DB table.
2. when you want to edit the record, the file upload feild is
blank and under it is the name of the file being used, so you can
upload a new file and change the one that record is using.
Here is my code so far, I don't have it set to do number 2.
yet, I am not sure how to do it and same goes for uploading the
file in the action script and making it add it to the DB record.
edit page code:
<cfset FormFieldList = "title,image,discription,body">
<cfif ParameterExists(URL.RecordID)>
<cfquery name="featRec" dataSource="creative"
maxRows=1>
SELECT feature.title, feature.image, feature.discription,
feature.body, feature.ID AS ID_Field
FROM feature
<cfif ParameterExists(URL.RecordID)>
WHERE feature.ID = #URL.RecordID#
</cfif>
</cfquery>
<cfif not ListFind( FormFieldList, "ID" )>
<cfset FormFieldList = ListAppend( FormFieldList, "ID"
)>
</cfif>
<cfset title_Value = '#featRec.title#'>
<cfset image_Value = '#featRec.image#'>
<cfset discription_Value = '#featRec.discription#'>
<cfset body_Value = '#featRec.body#'>
<cfelse>
<cfset title_Value = ''>
<cfset image_Value = ''>
<cfset discription_Value = ''>
<cfset body_Value = ''>
</cfif>
<head>
</head>
<body>
<cfoutput query="featRec">
<form action="Action.cfm" method="post" name="content"
id="content" onsubmit="saveIt()">
<input type="hidden" name="FieldList"
value="#FormFieldList#">
<cfif ParameterExists(URL.RecordID)>
<input type="hidden" name="RecordID"
value="#URL.RecordID#">
<input type="hidden" name="ID" value="#URL.RecordID#">
</cfif>
<input type="text" name="title" class="textInputs"
value="#title_Value#" maxLength="510">
<!--- this is the file uploader --->
<input type="file" name="MYFile">
<cfif MYFile IS defined>
#file#
</cfif>
<!--- end file uploader code --->
<input type="text" name="image" class="textInputs"
value="#image_Value#" maxLength="510">
<input type="text" name="discription" class="textInputs"
value="#discription_Value#" maxLength="510">
<textarea cols="" rows="" name="PDSeditor" style="display:
none">#Body_Value#</textarea>
</cfoutput>
<input type="submit" class="formButtons" name="feat_OK"
value=" OK ">
<input type="submit" class="formButtons"
name="feat_Cancel" value="Cancel">
</form>
Action Script:
<cffile Action="upload" filefield="uploadfile"
destination="
http://www.myurl.com/img/feature"
nameconflict="MAKEUNIQUE">
<cfif ParameterExists(Form.RecordID)>
<cfupdate dataSource="#sitedatasource#"
tableName="feature" formFields="#Form.FieldList#">
<cflocation url="feature_RecordView.cfm>
<cfelse>
<cfquery datasource="#sitedatasource#" dbtype="ODBC"
username="#siteUserID#" password="#sitePassword#">
INSERT INTO feature (title, image, discription, Body)
VALUES ('#form.title#', '#form.image#', '#form.description#',
'#form.PDSeditor#')
</cfquery>
<cflocation url="feature_RecordView.cfm>
</cfif>
<!--- End code --->
Can anyone help me? I am confused on how to make this work.
Thank you.
PhoenixLas listas de reproducción de vídeos se eliminaron del ios6 así que tienes que modificar los archivos de cada video y modificarlos como programas de TV, es la única solución por el momento. Atentamente desde Chile. Esteban flores
Maybe you are looking for
-
How to execute host command in trigger
dear professional: i'm trying to create a trigger that when a certain value inserts into a table , it fires some UNIX command to do the job following here is what i tried ,create a trigger that gives host command , but when i tried insert , it fails
-
A Disk read error has occurred
My laptop froze the other day and now when I try to boot I keep getting the message A disk read error occurred. Any ideas of what I can do to get my computer to boot?
-
Multi-region DVD player?
I bought my white Macbook back in the States, as well as my collection of DVD's. However, I am currently studying abroad in the UK for well over a year, and am frustrated to no end that I cannot watch anything but region one on my computer, without s
-
Fehlermeldung bei Premiere Elements 12
Hallo Ich habe mir gestern das Packet "adobe photoshop elements 12 & adobe premiere elements 12" gekauft. Photoshop funktioniert einwandfrei. Beim Premiere kommt immer die gleiche Fehlermeldung wenn ich das Programm starten will: Premiere Elements ha
-
Windows 8.1 shutdown options re: Bios
Am aware that 8 and its relation to Bios is different than other Windows versions. If I shutdown or restart from Win8 interface, the intro has a nice screen for selection of operating system to my dual-boot. If shut down through command, it appears