ActionScript 3.0 :: Accessing Child Properties - Dynamically Loaded Photo Is Portrait Or Landscape
Sep 17, 2008
I'm attempting to use "if" statements to determine if an dynamically loaded photo is portrait or landscape. The problem I'm having is when I try "gallery_mc.getChildAt(0).width", it returns 0.
View 10 Replies
Similar Posts:
Mar 20, 2006
i am building an xml gallery that pops up portrait and landscape images. the pop-up should fit each image. I had this working fine with the code below and then I added a few landscape images with different dimensions. now the landscape ones all pop-up with too much space around them. the first part of the function just puts the imeges in the right place on the movie;
[Code]...
View 1 Replies
Sep 16, 2011
This seems pretty weird even for Adobe standards. I've set up size of the movie to be 1024x768, which is the resolution of ipad screen in landscape. The stage looks ok but when I publish the swf it goes into portrait mode.
I even used this line of code but it doesn't help.
stage.setAspectRatio(StageAspectRatio.LANDSCAPE);
View 1 Replies
Nov 22, 2011
In Flex 4.5 for mobile how can I use portrait / landscape states from a skin file?
e.g. In the skin file I want to create the following states
<s:states>
<s:State name="portrait" />
<s:State name="landscape" />
</s:states>
and use them in the normal way. However the current state in the skin file is not updated when I switch between landscape and portrait.
View 1 Replies
Jan 25, 2011
How to save images a landscape picture and portrait size in FP10, there are ways?
View 13 Replies
Jun 23, 2011
I'm coding a image viewer application for tablets using Adobe Flex 4.5. Basically, I have a list with a custom item renderer that renders the images in the list. I have set up the image size to be the width/height of the tablet device in portrait (600x1024). This way, only one image can be seen at one time. The problem is that when the device orients to landscape, this design obviously screws up. My question is how can I get it to change the width/height of my images automatically when the orientation changes such that only one image is shown at a time?This is my list:
<s:List width="600" height="1024"
id="imageList" dataProvider="{data}" itemRenderer="{inlineRenderer}" click="imageList_clickHandler(event)"
verticalScrollPolicy="off" useVirtualLayout="true">
[code]....
This is the item renderer:
<s:Scroller width="600" height="1024">
<s:Group>
<s:Image source="{data.imageurl}" width="600" height="1024"
contentLoader="{FlexGlobals.topLevelApplication.imageCache}"/>
</s:Group> </s:Scroller>
View 1 Replies
Jun 8, 2011
Basically, I have a menu created using XML. Each menu item has a fill that fades in and out as the user scrolls over them. What I want to happen is that when an item is clicked, it stays highlighted. The problem comes when I click on the second item. I can't get the first item to "unselect."Here is the menu code and functions.
Code:
var menuHolder:MovieClip = new MovieClip();
menuHolder.x = myMask.x;
[code].....
View 6 Replies
Jun 21, 2007
I have a custom property called Player (like a basketball player) that has properties for points per game (ppg), rebounds per game (rpg), etc.I'm designing a piece where users can get averages and compare players across many different categories.
I have a String variable "stat" that tracks which property they want to compare. I can use "stat" in a sorton function, but need to use it to access the object property. So when the user chooses "ppg" or "rpg" i can access Player.ppg and Player.rpg by using the stat variable. Player.stat doesn't work.
View 2 Replies
Jun 27, 2010
hat is the correct way to access an object dynamically? I have tried this with no success:
Code:
i += 1;
var myVar = this[myObject. + "myProperty" + i];
[code].....
View 3 Replies
Jan 29, 2008
the variables listHeight and maskHeight won't populate. they come up 'undefined'.
here's the code essence:
Code:
xml.onLoad = function(success:Boolean)
{
var stuff:Array = xml.firstChild.childNodes;
if (success)
[Code]....
View 4 Replies
May 24, 2010
I am trying to set a couple of properties (specifically width and height) for an mc within an externally loaded swf but am having bigtime troubles. Keep getting the 'Error #1010: A term is undefined and has no properties'. The code is attached below. I have tried to figure this out and searched for solutions but could not resolve this myself.
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
[code]......
View 1 Replies
Oct 16, 2011
I have a MC with 2 children in library:
myParent1 -> myChild1
-> myChild2
when I put it on stage in editor and run following script, both trace are valid and give response "true":
ActionScript Code:
trace (myParent1.myChild2.visible); // true[code]....
but when I put MC on stage dynamically via addChild, the first trace gives
compiler error while second trace works(error: Scene 1, Layer 'Layer 1', Frame 1, Line 81120: Access of undefined property myParent1)
[code]....
View 3 Replies
Jan 7, 2012
How do I get to the MovieClips within an externally loaded Movie Clip. Lets say I have a movie Called ONE in the swf I just loaded. How can I work with it alpha, position and other properties of the children of this clip? CODE IN MAIN TIMLINE:
[Code]...
Now its loaded I want to change the postino of the clip called ONE in the movie LoadedMC I just created.
View 1 Replies
Apr 29, 2010
I am building an interface that loads swfs externally into an array(pre-loader) my code places these swfs into a container movie clip on stage when called.I am trying to access the swf that is now a child of the movie clip so i can rewind, pause, and play the swf.Currently they are loading in just fine, but my code isn't able to touch the swf. The swfs also play all the way through when they are loaded so when i change to the next one of the sequence my swf is already at its end frame.
Here is the code:
Actionscript Code:
stop();//Variable creation-----------------------------------------------------------------var _swfLoader:Loader;var _swfRequest:URLRequest;//creates an array with all the swfs locations inside--------------------------------var _swfPathArr:Array = new
[code]....
View 9 Replies
Apr 29, 2010
I am currently building an interface that loads externally loaded swfs into a movie clip on stage. I have no problem loading them in and switching between them. I am, however, having an issue accessing the swf, so that i can rewind, pause, and play the loaded swf.
Here is the code:
ActionScript Code:
stop();
//Variable creation-----------------------------------------------------------------
var _swfLoader:Loader;
[Code].....
View 5 Replies
Apr 24, 2010
My movieclip clipArt_mc receives movieclips that are loaded dynamically from a listbox selection using:
[Code]....
I would like to access the nested or loaded in movieclip inside of clipArt_mc that has in it a movieclip named color_mc so that I can apply color directly to it instead of clipArt_mc.
View 1 Replies
May 16, 2009
in (swfA.fla) I have this code in frame1
var module1:Loader = new Loader();
var admin = new MovieClip();
addChild(admin);
[Code]....
(my thought here is that 'admin' contains swfB.swf?) - this would seem very simple... but it...
...does not work and gives me this [seriously unhelpful] error:
TypeError: Error #1010: A term is undefined and has no properties.
at swfA_fla::MainTimeline/frame1()
View 7 Replies
Nov 19, 2011
I'm trying to make smoothing for images which loaded with loadclip(). I found function for smoothing and it works but only for movieclips located in _level0, for example _level0.mc, but I want to smooth children MC, for example _level0.parent_mc.children_mc and then image just disappears. Smoothing function:
here = this; // trace(here) == _level0
bg_smooth = function (bg):Void {
var bg_depth:Number = bg.getDepth();
var bg_name:String = bg._name;
var bg_parent = bg._parent;
[Code] .....
Also tried to write _level0.parent_mc['children_mc'] instead of parent_mc.children_mc and to make here == _level0.parent_mc - still no luck. If I remove bg_smooth (element) on load complete then all works fine but of course smoothing disabled.
View 1 Replies
Dec 16, 2010
The issue I'm having is that I have a main "wrapper" 100x100 (but it could be any size) - it's just there to hold and display whatever content, swf, gif, etc we may want to throw into it. As long as the loaded content doesn't have 3D animation like rotationY going on, it displays fine. But when it does, the 3D "anchor" properties (like projectionCenter) of the loaded swf inherit those of the main timeline (i.e. 100x100 (main) vs 728x90 (loaded)). If I change the dimension of the main "wrapper" in Flash IDE to match what's coming in - the 3D behaves fine, but I won't know what the dimensions of the content will be until it comes, so I need a way (if there is one) to dynamically alter the main "wrapper" or root display object through AS. Stuff like "this.width = loader.width" or "stage.width = loader.width" or "root.width = loader.width" etc doesn't work. Flex has the hBox and vBox
View 1 Replies
Sep 14, 2005
Just been playing around with the tutorials, on the Set properties/Get properties. Everything is all cool, except the "instance name" aspect. I dnt really understand that too well. Is it possible to change an Mc Name dynamically? If you look at my FLA when you hit the top left red button you will get a trace of the mcName as "square". Now if you input a new mc Name on the right hand side, you will see it change on the left hand side. But i want to know why it doesnt remain as the new mc Name, it still goes back to square.
View 3 Replies
Oct 14, 2011
I have a parent swf with three buttons: next button, back button, ticker on/off button.I have three child swfs, each with a ticker mc. When I click on ticker button on parent swfit dispatches a custom event which brings ticker MC on stage and thus ticker becomes visible (ticker off button displaces it out of stage by changing the value of ticker_mc.y).
the problem I am facing is when ticker is on and I click next or back button to load next or previous child swf, the ticker goes off. How can I make sure that ticker is on all the time and closes only when I close it. How can a loaded child swf 1 communicate to next child swf, child swf 2, which is currently not loaded, that since the ticker is on on swf 1 so you please keep the ticker on on swf 2 as well?!
I think I know the problem. I have put a default value of ticker_mc = 160 (makes ticker inactive) on every child swf. So, the ticker becomes inactive everytime I load a new child swf. If someone could guide how can I do this, my problem will be solved: When first child swf is loaded, the default value of ticker_mc.y should be 160. I want to hold this value in a variable. When I click ticker active btn, position of ticker_mc changes to 194 so the value of variable should change to 194. When I click next btn, the variable value (160 or 194) should be sent to next child swf and ticker_mc.y should be equal to variable value.
This is the code so far
"Next button"
go_mc.next_btn.addEventListener(MouseEvent.CLICK, playNext);
function playNext(e:MouseEvent):void {
if (swf_no < (clips.length-1)) {
[code]....
View 1 Replies
Jul 7, 2011
I'm doing some work with JSON in as3 using as3corelib (very useful) and was wondering if it is possible to get an object if all you have is one of its properties, also an object. Here's an example of some JSON:
"parentObject": {
"propertyObject": {
etc.
}
}
so what i'm asking is, if I have propertyObject, can I access parentObject somehow?
View 2 Replies
Oct 23, 2011
I am working on setting up some simple AI actions for my enemy class in the game that I am working on, but I am having trouble accessing the player's X location within the enemy package to set up a detection function. I have defined the player on my Level package along with the enemy, and I defined the player's and enemies X and Y locations within the Player/Enemies package respectively.
Within my flash file I have linked to my Level.as file. Also within my flash file library I have two movie clips. Both have a square in them that are the same size but colored differently. One is called PlayerSpriteMC and the other is called EnemiesSpriteMC.
[Code]...
View 1 Replies
Jul 1, 2009
I have two movie clips on the stage at frame 1 and frame 2. Both are instances of seperate classes. (They are not dynamically created, just their linkage is set to their class names)I have created soundChannel and Sound Objects in Class 1 and I want to access them from Class 2. (I want to stop the sound channel that was started in class 1)Is there any way to do this? If yes, will this be true for other properties also?
View 7 Replies
Jul 6, 2011
I'm doing some work with JSON in as3 using as3corelib (very useful) and was wondering if it is possible to get an object if all you have is one of its properties, also an object.Here's an example of some JSON:
ActionScript Code:
"parentObject": {
"propertyObject": {
[code].......
View 2 Replies
Apr 25, 2009
I'm having trouble accessing objects on new frames.On frame 1 I have:
Code:
var HelloWorld:Object = new Object()
On frame 2 I have:
[code]....
View 3 Replies
Dec 2, 2007
I seem to be having a bit of a problem here. I'm generating a load of class instances using the following code:
maxpersons=25;
for (var i:Number=1;i<=maxpersons;i++)
{
var person:Person = new Person;
[Code].....
OK. I then need to run through each of them and check for a collision with an object from the main stage (called redDot), which I pass to a method (called doDamage) within the class. I'm using the following code:
for (i=1;i<=maxpersons;i++)
{
if (game.getChildByName("person"+i).hitTestObject(red Dot))
{
game.getChildByName("person"+i).doDamage(redDot);
}
}
I keep getting an error saying "1061: Call to a possibly undefined method doDamage through a reference with static type flash.displayisplayObject."!
It just won't work. I've tried altering the code to:
game["person"+i].doDamage(redDot);
but I get an unexpected trace output saying "TypeError: Error #1010: A term is undefined and has no properties."
View 6 Replies
May 31, 2009
Is it possible to access variables or even functions of an embedded SWF? (One which has been embedded manually and has not loaded from somewhere)For example, I embed an swf called Movie1 which contains a string variable declared in its root, would it be possible for the parent SWF to access that string?
View 1 Replies
Nov 14, 2009
when I try to access a property of the document class from another class, I get an error:
Quote:
1119: Access of possibly undefined property _left through a reference with static type flash.displayisplayObject.
Maybe I'm not doing it correctly? This is how I've been accessing document class properties so far. Does the fact that they're private make a difference?
Quote:
root.property
View 1 Replies
Sep 16, 2010
I have written "components" in external .mxml files like dialogs and such. For example, GamePropertiesDialog.mxml. These components are used by another file, Main.mxml for example. If I instantiate a GamePropertiesDialog I am unable to access its pieces like a textbox with an id of GameName until AFTER I add the dialog to the display list.Doesn't work:
Actionscript Code:
var tmp:GamePropertiesDialog = new GamePropertiesDialog();tmp.GameName.text = 'test';addChild(tmp);
Does work: Actionscript Code:
var tmp:GamePropertiesDialog = new GamePropertiesDialog();addChild(tmp);tmp.GameName.text = 'test';
View 1 Replies